|
-
Oct 4th, 2006, 04:30 PM
#1
Thread Starter
New Member
how to wrote ' inside string in VB.net
Dim strSQL As String = "Select * from Doctors where first_name= '" & First_name.Text & "' and last_name= '" & Last_name.Text & "' "
Dim da As SqlDataAdapter = New SqlDataAdapter(strSQL, DBConn)
Dim ds As DataSet = New DataSet
da.Fill(ds)
My problem is: Last_name may contain ', for example O'Brien
the query will fail. strSQl= "select * from Doctors where last_name=O'Brien"
how can I wrote ' inside the string? for my textbox : Last_name.Text
it may contain ', what 's correct syntax to write my query?
Thanks!
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
|
Click Here to Expand Forum to Full Width
|