MySQL, ODBC and VB.NET...statement not working
Hi all,
Im getting an error when trying to execute this in VB.NET. It keeps telling me that column 'name' cannot be null but i assure you there is something in the name.value
Im using MySQL 5 as a backend. thing is, this was working when i had a string in which i built the sql statement myself. as you can imagine it got pretty messy so i decided to use params instead so I know this works without params.
sqlcom = "INSERT INTO authors (name, dispname, password, email, country, location, timezone, about, image, disppublic, disppublicifwin) " & _
"VALUES (@name, @dispname, SHA(@password), @email, @country, @location, @timezone, @about, LOAD_FILE(@image), @disppublic, @disppublicifwin);"
db = New OdbcConnection(ConfigurationSettings.AppSettings.Get("dbCon"))
dbCom = New OdbcCommand(sqlcom, db)
'And yes I have tried specifying the size as well.
dbCom.Parameters.Add("@name", OdbcType.Text).Value = name.Value
dbCom.Parameters.Add("@dispname", dispname.Value)
dbCom.Parameters.Add("@password", password.Value)
dbCom.Parameters.Add("@email", email.Value)
dbCom.Parameters.Add("@country", country.Value)
dbCom.Parameters.Add("@location", location.Value)
dbCom.Parameters.Add("@timezone", timezone.Value)
dbCom.Parameters.Add("@about", about.Value)
dbCom.Parameters.Add("@image", saveLocation.Replace("\", "/"))
dbCom.Parameters.Add("@disppublic", disppublic.Checked)
dbCom.Parameters.Add("@disppublicifwin", disppublicifwin.Checked)
db.Open()
dbCom.Prepare()
If dbCom.ExecuteNonQuery() <> 1 Then
Response.Write("somethings gone wrong")
End If
thanks for taking some spare seconds
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Bookmarks