How do i use the datagrid control with northwind???
hey,
i am using ms sql server and visual studio 2003.
i am trying to use northwind with a datagrid control, but my problem is i don't know where to put the northwind database that i downloaded or how to use it.
I know my strConnection is wrong. How do i fix this so that i can use the northwind database?
what is my server? pwd? and database? do i place the exact location where the northwind databae is located? like C:\... the book i am using is ASP.Net oreilly
they have the connection string as
string strConnection = "server=YourServer; uid=sa; pwd=YourPW; database=northwind";
here is my code:
// create the connection string
string strConnection = "server=localhost; uid=sa; pwd=; database=Nwind";
// create the command string
string strCommand = "Select * from Customers";
// create the data set command object and dataset
SqlDataAdapter dataAdapter = new SqlDataAdapter(strCommand, strConnection);
DataSet dataSet = new DataSet( );
// fill the dataset
dataAdapter.Fill(dataSet, "Customers");
SqlCommandBuilder bldr = new SqlCommandBuilder(dataAdapter);
// get the table
DataTable dataTable = dataSet.Tables[0];
dgCustomers.DataSource = dataTable;
dgCustomers.DataBind( );
thanks, hope to hear i am answer spent 2 1/2 hours already!!!
john