|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
unknown column value
I have problems inserting the values.
This is an ado connection to a sql database... the code works..except it doesn't put the name value or the phone value in the database... when i replace the variables with 'field1', 'field2' it works... but what I need to do is have it insert actual fields, since the fields are always changing... -------------- Private Sub Command1_Click() Dim phone_value As String Dim name_value As String Dim conn As New ADODB.Connection phone_value = "555-555" name_value = "test" conn.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};SERVER=localhost;DATABASE=phone_number;UID=root;PWD=legend;" conn.CursorLocation = adUseClient conn.Open 'direct insert [this is the part that's giving me the hard-time] conn.Execute "INSERT INTO phone_1(phone_number, name_id) values(phone_value,name_value)" End Sub ---------------- thanks in advance Last edited by sparkrulez : January 17th, 2003 at 12:47 PM. |
|
#2
|
||||
|
||||
|
As far as I know you cannot do what you are trying to do.
What it sounds like you want is a view, but unfortunately is not currently possible with mysql. You might check the mysql documentation and see, but I don't believe it is possible. |
|
#3
|
|||
|
|||
|
it has to be possible
I want to insert
phone_value = "555-555" name_value = "test" into my database when i try conn.Execute "INSERT INTO phone_1(phone_number, name_id) values('555-555','test')" it works...but when i try conn.Execute "INSERT INTO phone_1(phone_number, name_id) values(phone_value,name_value)" it does not work |
|
#4
|
||||
|
||||
|
Oh, sorry, I misunderstood you.
In you sql statement you have to surround your variables in single quotes. i.e. Code:
dim sql = "INSERT INTO phone_1(phone_number, name_id) values('" & phone_value & "', '" & name_value & "')"
conn.Execute sql
|
|
#5
|
|||
|
|||
|
AWESOME
No problems, I probably just explained it all wrong...
that's what I was looking for. Thanks for taking the time to give a newbie a hand... :-) |
|
#6
|
||||
|
||||
|
not a problem, we all start somewhere.
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Visual Basic Programming > unknown column value |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|