Incorrect syntax near 'Calculation'.

sql server India
  • 13 years ago

    I am using VS 2005 + SQL Server 2000.

    The piece of code is as follows

         Public Function GetAppId(ByRef AN As String) As String        Dim scon As New System.Data.SqlClient.SqlConnection ‘ declare the connection        scon.ConnectionString = ConfigurationManager.ConnectionStrings("strSimCon").ToString ‘ strSimCon is connection ‘ ‘string  stored in web.config file        scon.Open()’ opening of connection        Dim querystring As String = "Select AppCode From ApplicationData Where AppName=" & AN ‘ AN is the ‘ string which will contain Name of The application. On the basis of this name a unique ID will be retrieved.        Dim myCommand As New System.Data.SqlClient.SqlCommand(querystring, scon)        Dim sreader As System.Data.SqlClient.SqlDataReader       * sreader = myCommand.ExecuteReader(System.Data.CommandBehavior.CloseConnection)’ I have tried using no  option or all other options .But no result.        GetAppId = sreader.GetString(0)        Return GetAppId

        End Function

     

    I am getting an error (exception) as

    System.Data.SqlClient.SqlException: Line 1: Incorrect syntax near 'Calculation'.  

    Can anyone guide me what is not correct?
     

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“The first 90% of the code accounts for the first 90% of the development time. The remaining 10% of the code accounts for the other 90% of the development time.” - Tom Cargill