adding row to SQL DB

Results 1 to 2 of 2

Thread: adding row to SQL DB

  1. #1
    Join Date
    Dec 1969

    Default adding row to SQL DB

    I&#039;m new with .net and I&#039;m not enjoying it so please take it easy with me. I have a scenario where I&#039;m going through a series of forms and getting information. At the end of the forms I need to add the information to a table in my db. I don&#039;t have a datagrid that I&#039;m using for this nor am I using a dataset. Can someone point me to an example for adding a new record without a datagrid or dataset? Or, do I have to have a dataset? If so, then how do I get my form variables to fill in my dataset? I&#039;m totally lost on this.<BR>Thanks,<BR>Ricki

  2. #2
    Join Date
    Dec 1969

    Default RE: adding row to SQL DB

    Basically, use a Command Object with the ExecuteNonQuery Method:<BR><BR><BR>string strConn = ConfigurationSettings.AppSettings["MyConn"];<BR>string strSQL = "INSERT INTO tbl...." //Your Insert Statement Here<BR>OleDbConnection objConn = new OleDbConnection(strConn);<BR>OleDbCommand objCmd = new OleDbCommand(strSQL, objConn);<BR>objConn.Open();<BR>objCmd.ExecuteNonQ uery();<BR>objConn.Close();<BR>objConn.Dispose();< BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts