Skip to main content
gamedev.net
🔒 Locked

visual basic and access

Started by yoda5 May 23, 2003 at 4:19 PM 1 replies 200+ views
Original Post
yoda5
yoda5
New to visual basic and access and I am trying to do an SQL statement but the where clause would be "where Id = 1" for instance, but I want 1 to be a variable, is there any way to do this or is there something that can build SQL statements from variable values? Thanks guys
ApochPiQ
ApochPiQ
Dim SQL As String
Dim TableName As String
Dim FieldName As String
Dim Value As Long

TableName = "SomeTable"
FieldName = "SomeField"
Value = 48

SQL = "SELECT * FROM " & TableName & " WHERE " & FieldName & " = " & Value

'' execute SQL query here
yoda5
yoda5
Thanks Apochpia, that got it going for me.

The books I have seen so far have been really bad. Does anyone know a good Visual Basic or Java programming book? Thanks

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.