I feel that this may have wandered a little bit off what I am trying to do, essentialy I'm simply trying to add records into a database ms (2003) using textboxes in visual basic.

Anyone know anything simple?



ok. i hope it is not too late. this is what i have done in my school project and so far it is working good. here is the code.


 Dim newRow As DataRow = DataSet1.Tables("Database_Table").NewRow()

            'Code for specifying the fields to be entered into the database

            newStudentsRow("Table_Field1") = TextBox1.Text
            newStudentsRow("Table_Field2") = TextBox2.Text

            'Code for adding a new row in the database


            'Code for saving the entered details to the database


            MsgBox("Record Successfully Saved", MsgBoxStyle.Information)

 Catch ex As Exception

            MsgBox("Error saving record", MsgBoxStyle.Exclamation)
        End Try

End Sub 

if you have any question regarding this. Send me a message..........

Edited by rowneyo


what is the error in following:

sql = " INSERT INTO Minute_Sheet (Sr_No,Site_Name,Initiating_Branch,Subject,Est_Amount,Installation_Address,Remarks,Work_Order_No,Contractor,To_APEME,By_APEME,To_DM,By_DM,To_STEC,By_STEC,To_ADHA,By_ADHA) Values(" & txtSrNumber.Text & ",'" & txtSiteName.Text & "','" & txtIniBranch.Text & "','" & txtSubject.Text & "'," & txtEstAmount.Text & ",'" & txtInstalladdress.Text & "','" & txtRemarks.Text & "'," & txtWorkOrderNumber.Text & ",'" & txtContractor.Text & "',#" & txtToAPEME.Text & "#,#" & txtByAPEME.Text & "#,#" & txtToDM.Text & "#,#" & txtByDM.Text & "#,#" & txtToSTEC.Text & "#,#" & txtBySTEC.Text & "#,#" & txtToADHA.Text & "#,#" & txtByADHA.Text & "#)"

Edited by Reverend Jim: Corrected code formatting


Hello and welcome to the forum.
Please don't hijack old threds and use code button when you are posting code.

Start a new thread with your question and I'm sure somebody will help you.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.