Hi. Here is the code posted by RadhaDotNet in C#
protected void Button1_Click(object sender, EventArgs e)
{
try {
if (FileUpload1.HasFile) {
string str = FileUpload1.FileName;
if (chechkfile(str)) {
string path = "~/photos/" + FileUpload1.FileName;
FileUpload1.SaveAs(MapPath(path));
con.Open();
SqlCommand cmd = new SqlCommand("insert into images values('" + TextBox1.Text + "','" + path + "')", con);
cmd.ExecuteNonQuery();
con.Close();
}
}
}
catch (Exception exp) {
Response.Write(exp.ToString());
}
}
protected void Page_Load(object sender, EventArgs e)
{
string image = Request.QueryString("images").ToString();
SqlDataAdapter da = new SqlDataAdapter("select Images from images where images='" + image + "'", con);
DataSet ds = new DataSet();
con.Open();
da.Fill(ds, "images");
if (ds.Tables("images").Rows.Count > 0) {
Image1.ImageUrl = ds.Tables("images").Rows(0)(0).ToString();
}
con.Close();
}
All you needed to do was copy 'N' paste it in VB to C# convertor and get the output and copy 'N' paste it back in your code editor!
Regards,
Bhushan.