dinodod
asked on
Type 'SQLDataSetCommand' is not defined. ??
Ok, I'm trying to use a Code Behind with a Datagrid that simply pulls info out from a MS SQL DB
However, i get the error: Type 'SQLDataSetCommand' is not defined. What gives? I am copying the source code from: http://www.dotnetjunkies.com/tutorials.aspx?tutorialid=54
Also, can you recommend any good sites to learn more about code behind's? I am looking into 4guysfromrolla now.
THANKS!
Here is my code:
Option Strict Off
Imports System
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.HtmlControls
Imports System.Data
Imports System.Data.SQLClient
Public Class myPage : Inherits Page
Public myDataGrid As DataGrid
Public myLabel As Label
Public Property myProp As String
Get
Return myLabel.Text
End Get
Set
myLabel.Text = Value
End Set
End Property
Public Sub Page_Load(Source As Object, E As EventArgs)
Dim ds As New DataSet
Dim dsc As SQLDataSetCommand
DIM dsc = New SQLDataSetCommand("SELECT CompanyName, ContactName, ContactTitle FROM Customers", _
"server=localhost;uid=sa;p wd=;databa se=Northwi nd;")
dsc.FillDataSet(ds, "Customers")
myDataGrid.DataSource = ds.Tables("Customers").Def aultView
myDataGrid.DataBind()
End Sub
End Class
However, i get the error: Type 'SQLDataSetCommand' is not defined. What gives? I am copying the source code from: http://www.dotnetjunkies.com/tutorials.aspx?tutorialid=54
Also, can you recommend any good sites to learn more about code behind's? I am looking into 4guysfromrolla now.
THANKS!
Here is my code:
Option Strict Off
Imports System
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.HtmlControls
Imports System.Data
Imports System.Data.SQLClient
Public Class myPage : Inherits Page
Public myDataGrid As DataGrid
Public myLabel As Label
Public Property myProp As String
Get
Return myLabel.Text
End Get
Set
myLabel.Text = Value
End Set
End Property
Public Sub Page_Load(Source As Object, E As EventArgs)
Dim ds As New DataSet
Dim dsc As SQLDataSetCommand
DIM dsc = New SQLDataSetCommand("SELECT CompanyName, ContactName, ContactTitle FROM Customers", _
"server=localhost;uid=sa;p
dsc.FillDataSet(ds, "Customers")
myDataGrid.DataSource = ds.Tables("Customers").Def
myDataGrid.DataBind()
End Sub
End Class
there is no SQLDataSetCommand, use SqlDataAdaper instead
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
Answered by GoodJun
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
TheLearnedOne
EE Cleanup Volunteer
I will leave a recommendation in the Cleanup topic area that this question is:
Answered by GoodJun
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
TheLearnedOne
EE Cleanup Volunteer