Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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()

Rufus
Posted

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

Posted

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.

Rufus

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...