Hi there, new to ASP.NET, been using ASP for years. Anyway, working on building an app in ASP.NET and running into some questions about datasets. Here is my code:
Code:
Dim dstCustomers As DataSet
Dim conMVP as SqlConnection
Dim dadCustomers as SqlDataAdapter
Dim strCustomersSQL as String
dstCustomers = New DataSet()
conMVP = New SqlConnection("server=ENVWDB;uid=web;pwd=xxx;database=xxx;")
strCustomersSQL = "SELECT customer, name) FROM TSE...customers"
dadCustomers = New SqlDataAdapter( strCustomersSQL, conMVP )
dadCustomers.Fill( dstCustomers, "customer")
dropCustomers.DataSource = dstCustomers
dropCustomers.DataTextField = "customer"
dropCustomers.DataBind()
Ok, so the first part that I'm having trouble with is:
dadCustomers = New SqlDataAdapter( strCustomersSQL, conMVP )
Here I'm in effect setting up a way to pull the return of my SQL statement from SQL Server correct?
dadCustomers.Fill( dstCustomers, "customer")
Now this is where the real confusion comes for me... I'm filling my dataset with the return from my query, but what is "customer"? The name of the table I'm putting it into in the dataset? The name of the the column of data I want to put into it? I thought the latter, but then I shouldn't be able to do this:
Response.Write( dstCustomers.Tables("customer").Rows(1)("name").To String() )
The whole query is getting put into it... so obviously I'm confused and missing something.
I suspect this is an easy one, if someone could set me straight it would be much appreciated.
Pat