none
Noobish question (Dtabase) RRS feed

  • Question

  • Please can you explain this code to me :

     // Specify a connection string. Replace the given value with a 
    // valid connection string for a Northwind SQL Server sample
    // database accessible to your system.
    String connectionString =
                "Integrated Security=SSPI;Persist Security Info=False;" +
    "Initial Catalog=Northwind;Data Source=localhost";

    I get err when I try to compile it I get error and I don't get this line
    //database accessible to your system.

    so please can you explain it to me


    Thursday, February 21, 2008 7:46 PM

Answers

  • Is that the complete message?  And it occurs on this line....

     

    Code Snippet
    dataAdapter.Update((DataTable)bindingSource1.DataSource);

     

    ...?

    I don't like the name of your DataTable.  Is it DataTable?

     

    Rudedog

     

    Saturday, February 23, 2008 2:57 PM

All replies

  •  

    what error do you get?
    Thursday, February 21, 2008 7:57 PM
  •  

    There aren't any errors with that line of code. I copied and pasted it into visual studio just in case I was missing something  and it compiled fine.
    Thursday, February 21, 2008 9:16 PM
  •  nYxY wrote:
    Please can you explain this code to me :

     // Specify a connection string. Replace the given value with a 
    // valid connection string for a Northwind SQL Server sample
    // database accessible to your system.
    String connectionString =
                "Integrated Security=SSPI;Persist Security Info=False;" +
    "Initial Catalog=Northwind;Data Source=localhost";

    I get err when I try to compile it I get error and I don't get this line
    //database accessible to your system.

    so please can you explain it to me


     

    Are you trying to connect to an instance of SQL Server Express?  The Northwind sample database?

     

    Code Snippet

    String connectionString =

    @"Data Source=.\SQLEXPRESS;AttachDbFilename=C:\FolderPath\DataBase.mdf;Trusted_Connection=true";

     

     

    The above string should connect to a SQL file that is unattached to an instance of SQL.

     

    Rudedog

    Thursday, February 21, 2008 9:20 PM
  • Thank you very much, I've done connection string,but new problem showed up, when I run my programm and click the Button,  I get this err (err shows up ad msg box after clicking button):

    Code Snippet

    Unable to cast object of type
    'WindowsFormsApplication1.parkingDataSet'
    'System.Data.DataTable'



    And the code for button is :

    Code Snippet

    private void button1_Click(object sender, EventArgs e)
            {
                dataAdapter.Update((DataTable)bindingSource1.DataSource);
            }


    Saturday, February 23, 2008 11:33 AM
  • Is that the complete message?  And it occurs on this line....

     

    Code Snippet
    dataAdapter.Update((DataTable)bindingSource1.DataSource);

     

    ...?

    I don't like the name of your DataTable.  Is it DataTable?

     

    Rudedog

     

    Saturday, February 23, 2008 2:57 PM