rufus Posted July 8, 2003 Posted July 8, 2003 hi mrdutchie, try this. Dim command As New OleDb.OleDbCommand() command.CommandText = "insert into companyinformation (company1) values (@company1)" command.Connection = oledb_connect With command .Parameters.Add("@company1", txtcity.Text.Trim) End With command.ExecuteNonQuery() Quote Rufus
mrdutchie Posted July 8, 2003 Posted July 8, 2003 Tried it, but it's failing on oledb_connect if I leave that to connection1 then it looks like Dim command As New OleDb.OleDbCommand With command .Parameters.Add("@company1", "Test") .CommandText = "Insert into Companyinformation (company1) values (@company1)" .Connection = connection1 End With connection1.Open() command.ExecuteNonQuery() connection1.Close() I need to have the open and Close statement in it But still getting the same error. Also tried to put the .Add on a different row Quote
rufus Posted July 8, 2003 Posted July 8, 2003 as your error says system.data.oldeexception, is the fields are of same type. did you made the company1 varchar and the textbox.trim, sometimes the space values in the textbox may cause error. if it is failing on ole_connect, your connection string is wrong, try to check the login and psswd and check the datasource. Quote Rufus
mrdutchie Posted July 8, 2003 Posted July 8, 2003 It's working now :) 1 field was set a Required... missed that one a couple of times. Thanks for your help Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.