[thelist] using a form.text object in an Insert command

Casey Crookston casey at thecrookstons.com
Mon Dec 20 21:30:45 CST 2004


myAddMemberCmd = New OleDbCommand("INSERT INTO members (fname) VALUES
('Fubar')", myDbConn)

This works fine.  But what if the value of fname is held in fname.text after
a form submission?  Confused on the syntax.

Here's all the code:

 Sub Submit_Button_Click(Sender As Object, E As EventArgs)

   Dim myDbConn As OleDbConnection
   Dim myAddMemberCmd As OleDbCommand

   myDbConn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data
Source=C....mdb")
   myAddMemberCmd = New OleDbCommand("INSERT INTO members (fname) VALUES
('fname.text')", myDbConn)
   myDbConn.open()
   myAddMemberCmd.ExecuteNonQuery()
   myDbConn.close()

 End Sub




More information about the thelist mailing list