Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. plz check y there is an erro in reading data

plz check y there is an erro in reading data

Scheduled Pinned Locked Moved ASP.NET
helpdatabasedesign
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Ali_100
    wrote on last edited by
    #1

    errror generate when the data reader read.i have made the login project, the error write that (Incorrect syntax near the keyword 'user') . but there is not a problem in table name because i have change it to users than it will give different error the error occurred in loReader = loCommand.ExecuteReader() Imports System Imports System.Data.Sql Imports System.Data Imports System.Data.SqlClient Partial Public Class _Default Inherits System.Web.UI.Page Public Shared lsConnectionString As String Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load End Sub Protected Sub Login1_Authenticate(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.AuthenticateEventArgs) Handles Login1.Authenticate Dim loConnection = New SqlConnection(lsConnectionString) Dim loCommand As New SqlCommand("SELECT * FROM user", loConnection) Dim lsUsername, lsPassword, lsUserType, lsstatus, lscount As String Dim loReader As SqlDataReader 'Dim abc As IDataReader loConnection.Open() error here loReader = loCommand.ExecuteReader() 'abc = loCommand.ExecuteReader() loReader = loCommand.ExecuteReader While loReader.Read() lsUsername = CStr(loReader("username")) lsPassword = CStr((loReader("password"))) lsUserType = CStr((loReader("usertype"))) End While loConnection.Close() End Sub End Class

    A A 2 Replies Last reply
    0
    • A Ali_100

      errror generate when the data reader read.i have made the login project, the error write that (Incorrect syntax near the keyword 'user') . but there is not a problem in table name because i have change it to users than it will give different error the error occurred in loReader = loCommand.ExecuteReader() Imports System Imports System.Data.Sql Imports System.Data Imports System.Data.SqlClient Partial Public Class _Default Inherits System.Web.UI.Page Public Shared lsConnectionString As String Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load End Sub Protected Sub Login1_Authenticate(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.AuthenticateEventArgs) Handles Login1.Authenticate Dim loConnection = New SqlConnection(lsConnectionString) Dim loCommand As New SqlCommand("SELECT * FROM user", loConnection) Dim lsUsername, lsPassword, lsUserType, lsstatus, lscount As String Dim loReader As SqlDataReader 'Dim abc As IDataReader loConnection.Open() error here loReader = loCommand.ExecuteReader() 'abc = loCommand.ExecuteReader() loReader = loCommand.ExecuteReader While loReader.Read() lsUsername = CStr(loReader("username")) lsPassword = CStr((loReader("password"))) lsUserType = CStr((loReader("usertype"))) End While loConnection.Close() End Sub End Class

      A Offline
      A Offline
      ABitSmart
      wrote on last edited by
      #2

      User is an SQL keyword. Either you have mispelt your table name or you are in the wrong direction.

      1 Reply Last reply
      0
      • A Ali_100

        errror generate when the data reader read.i have made the login project, the error write that (Incorrect syntax near the keyword 'user') . but there is not a problem in table name because i have change it to users than it will give different error the error occurred in loReader = loCommand.ExecuteReader() Imports System Imports System.Data.Sql Imports System.Data Imports System.Data.SqlClient Partial Public Class _Default Inherits System.Web.UI.Page Public Shared lsConnectionString As String Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load End Sub Protected Sub Login1_Authenticate(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.AuthenticateEventArgs) Handles Login1.Authenticate Dim loConnection = New SqlConnection(lsConnectionString) Dim loCommand As New SqlCommand("SELECT * FROM user", loConnection) Dim lsUsername, lsPassword, lsUserType, lsstatus, lscount As String Dim loReader As SqlDataReader 'Dim abc As IDataReader loConnection.Open() error here loReader = loCommand.ExecuteReader() 'abc = loCommand.ExecuteReader() loReader = loCommand.ExecuteReader While loReader.Read() lsUsername = CStr(loReader("username")) lsPassword = CStr((loReader("password"))) lsUserType = CStr((loReader("usertype"))) End While loConnection.Close() End Sub End Class

        A Offline
        A Offline
        Agweet
        wrote on last edited by
        #3

        Hi, what u can do is replace

        SELECT * FROM user

        with

        SELECT * FROM [user]

        then it will get recognized as a table name...

        living life on the flip side

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups