Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Help with building a sql string
Message
 
To
All
General information
Forum:
Visual Basic
Category:
Coding, syntax & commands
Title:
Help with building a sql string
Miscellaneous
Thread ID:
00671415
Message ID:
00671415
Views:
59
I have a vb.net webform, where the user id is collected. I have sqlstring I build to get the data based off their id. If I hardcode the value in, everything works fine (with the exception that I have a hardcoded value). When I try to add the value into the string, it craps out on the query. Below is the hardcoded one that works, I am changing the last line in the sqlString.
        sqlString = "SELECT TOP 100 PERCENT dbo.codept.deptdesc, dbo.corooms.roomname, " & _
        "dbo.meetings.begintime, dbo.meetproc.description, dbo.coper.lastname, dbo.coper.firstname, dbo." & _
        "codept.deptid, dbo.corooms.roomid, dbo.meetings.meetingnumber FROM dbo.meetings " & _
        "INNER JOIN dbo.patients ON dbo.meetings.patientid = dbo.patients.patientid INNER" & _
        " JOIN dbo.meetproc ON dbo.meetings.meetingnumber = dbo.meetproc.meetingnumber IN" & _
        "NER JOIN dbo.corooms ON dbo.meetings.roomid = dbo.corooms.roomid INNER JOIN dbo." & _
        "codept ON dbo.meetings.deptid = dbo.codept.deptid LEFT OUTER JOIN dbo.coper ON d" & _
        "bo.meetproc.coperid = dbo.coper.coperid WHERE (dbo.meetings.iscancelled = 0) AND" & _
        " (dbo.meetings.isblock = 0) AND (dbo.meetings.roomclosed = 0) AND " & _
        "(dbo.meetproc.coperid = 1)"

        OleDbSelectCommand1.CommandText = sqlString
I am trying to change the last line to:
       "(dbo.meetproc.coperid = " & docID & ")"
docID is a publicly defined variable as a String and has the correct value (I'm displaying it on the page when the page loads)

Thanks for any help
Next
Reply
Map
View

Click here to load this message in the networking platform