afroz khan

afroz khan

  • NA
  • 62
  • 0

Anybody convert c# code into vb.net

Sep 25 2008 12:49 AM

Can anybody help me to conver C# code into vb.net

 

protected void View_Click(object sender, EventArgs e)

{

MemoryStream stream = new MemoryStream();

string strcon = "Data Source=(local) ;Initial Catalog=SaveImage; User ID=sa; Password=sa;";

SqlConnection con=new SqlConnection(strcon);

con.Open();

//string strcmd = "select Doc from trn_Image where iDocID=" + Convert.ToInt32(TextBox2.Text);

//string strcmd = " select * from trn_Image where cReportType=" + Convert.ToString(TextBox2.Text);

SqlCommand cmd = new SqlCommand("Select * from trn_Image where cReportType= @cReportType", con);

cmd.Parameters.Add("@cReportType", SqlDbType.VarChar);

cmd.Parameters["@cReportType"].Value = TextBox1.Text;

 

//SqlCommand cmd = new SqlCommand(strcmd,con);

byte[] obj = (byte[])cmd.ExecuteScalar();

Response.ContentType="Application/msword";

Response.BinaryWrite((byte[])cmd.ExecuteScalar());

Response.End();

con.Close();

}


Answers (7)