Declaration Expected when connecting to SQL Server RRS feed

  • Question

  • User948971805 posted

    Apologies if this is a dumb question.  I'm very new to .net

    I'm using C# to try to send a query to SQL Server, and I'm using the following code:

    <script runat="server">

    System.Data.SqlClient.SqlConnection sqlconnection1 =
    new System.Data.SqlClient.SqlConnection("Data Source=;Initial Catalog=;User Id=;Password=;");

    System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand();
    command.CommandType = System.Data.CommandType.Text
    command.CommandText = "INSERT STATEMENT">;
    command.Connection sqlconnection1;



    I get "BC30188: Declaration expected."

    I'm not sure what this error means.  Can anyone advise?

    Thursday, March 1, 2012 7:07 PM

All replies

  • User-158764254 posted

    I think the issue would be with whatever your actual sql insert statement was.  So you'd needed to share that insert so we can see what it looked like.

    Thursday, March 1, 2012 7:51 PM