Current location: Hot Scripts Forums » Programming Languages » ASP » Syntax error (missing operator) in query expressio Help>>>>>>>


Syntax error (missing operator) in query expressio Help>>>>>>>

Reply
  #1 (permalink)  
Old 03-12-11, 12:10 AM
barcan barcan is offline
New Member
 
Join Date: Mar 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Syntax error (missing operator) in query expressio Help>>>>>>>

this is the code
__________________________________________________ _______
Protected Sub Button3_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button3.Click
Dim Conn As New System.Data.OleDb.OleDbConnection("provider=micros oft.jet.oledb.4.0;data source=C:\Documents and Settings\MasterMinds\My Documents\Visual Studio 2008\Projects\WebApplication1\db1.mdb")
Conn.Open()
Dim sql As String
Dim i As Boolean
sql = "select StudentID,StudentPass from st1 Where [StudentID =]'" & Trim(TextBox1.Text) & "' AND [StudentPass =]'" & Trim(TextBox2.Text) & "' "

Dim cmd As New System.Data.OleDb.OleDbCommand(sql, Conn)
cmd = New OleDb.OleDbCommand(sql, Conn)
i = cmd.ExecuteNonQuery()
If (i = True) Then
Response.Redirect("~/stpage.aspx")
Else
Label5.Text = "Invalid username or password"
End If

cmd = Nothing

Conn.Close()
End Sub
__________________________________________________ __


and this is the error


Syntax error (missing operator) in query expression '[StudentID =]'20115001' AND [StudentPass =]'123456''.
Reply With Quote
  #2 (permalink)  
Old 12-03-11, 10:22 AM
irealtysolution's Avatar
irealtysolution irealtysolution is offline
New Member
 
Join Date: Dec 2011
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Change the sql string to:
Quote:
sql = "SELECT StudentID, StudentPass from st1 Where StudentID ='"& Trim(TextBox1.Text) & "' AND StudentPass ='" & Trim(TextBox2.Text) & "' "

Thanks!
Zeeshan Dar
CEO iRealtySolution
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Syntax error (missing operator) in query expression 'Site_Info.Location_ID='. minime ASP 5 03-11-09 02:51 AM
Syntax Error Nikas Database 4 05-15-08 10:48 AM
Declared Functions skipper23 PHP 4 12-17-03 10:06 AM
index page not showing up skipper23 PHP 3 12-15-03 01:10 PM
Syntax error (missing operator) in query expression crobinson ASP 4 11-23-03 08:49 PM


All times are GMT -5. The time now is 04:10 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.