Well theres two ways this can be done articture wise
Connected one has already been posted
Disconnected one
//i hope you know how a connection String is formed
SqlConnection con=new SqlConnection(connectionString);
//data set holds the schema
DataSet ds=new DataSet();
SqlDataAdapter da=new SqlDataAdapter("select * from db",con);
da.Fill("tablename");
//Command builder builds the command for you
SqlCommandBuilder cbd=new SqlCommandBuilder(da);
//data table holds a particular table
DataTable dt=ds.Tables["tablename"];
// add a new blank row
DataRow dr=dt.Rows.Add();
//start adding rows
dr[0]="Primary key";
dr[1]="name";
dr[2]=double.Parse(textBox1.Text);
//done? then commit the row
int rowAdded=da.Update("tablename");
Response.Write(rowAdded.ToString()+" no. of rows added");
|