Insert/Update Statement Examples?

  • Thread starter Thread starter Joey D
  • Start date Start date
J

Joey D

Hi,

I am moving from classic ASP to ASP.NET 2.0. I have gone through the
quick start info. One of my top questions is on insert/update/delete
statements. I am unable to find examples/walk-throughs on how to do
this in 2.0 (without using the server controls like gridview). Can
anyone point out walk throughs or examples of how to do this?

Thanks,
William D.
http://www.ultraweaver.com
 
Just open connection and use SQLCommand object.

SqlConnection con = new SqlConnection(clsGlobal.sConnection );

SqlCommand com = new SqlCommand();

com.CommandText = "DELETE FROM tblSectionInPage WHERE PageId=" +
_iPageId.ToString();

com.CommandType = CommandType.Text;

con.Open();

try

{

com.ExecuteNonQuery();

}

finally

{

con.Close();

}

George
 
Thanks for the example. I will look up SQL Command for further info.

Thanks again for the reply/example! Exactly what I needed.
 
Oh... last question.. I take it that from the Freamwork 1.1 to 2.0, SQL
command is basically the same?
 
Can not tell you about 2.0 because did not work with it.
but even if that is not the same I would think it should be similar.

George.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top