The code below is for a button which needs to send data to a sql DB
I have two questions:
1 Does anyone have a sample code snippet that i can look at to see how to do this
2 would it be better to pass the variables to a stored procedure
and have the DB do the insert
or
should i just code it in as an insert into
My initial instinct is to use a stored procedure as that would make it easier
to upgrade/change in the future if needed.
Code:
private void Submit_btn_Click_1(object sender, EventArgs e)
{
//submit data to the desc_table
/*connecting to database to perform task
* connection variable. open();
* function
* .close(); */
myconnection.Open();
//do stuff
myconnection.Close();
}
Thanks all in advance
ForgottenhartPosted Aug 6, 2007, 11:38 PM
Thanks, I finally got it to work only to realize that it wont work for what i need done.
oh well..you code you learn
Mahesh ChandPosted Aug 6, 2007, 8:12 AM
Here is an example:
http://www.c-sharpcorner.com/UploadFile/jeradus/UsingSQLP112032005062034AM/UsingSQLP1.aspx
I would recommend use inline SQL for small applications but use SP when your application gets complex.