?
Solved

Type 'SQLDataSetCommand' is not defined. ??

Posted on 2003-03-20
3
Medium Priority
?
680 Views
Last Modified: 2012-05-04
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;pwd=;database=Northwind;")
          dsc.FillDataSet(ds, "Customers")
          myDataGrid.DataSource = ds.Tables("Customers").DefaultView
          myDataGrid.DataBind()
     End Sub


End Class
0
Comment
Question by:dinodod
  • 2
3 Comments
 
LVL 10

Expert Comment

by:GoodJun
ID: 8176237
there is no SQLDataSetCommand, use SqlDataAdaper instead
0
 
LVL 10

Accepted Solution

by:
GoodJun earned 1000 total points
ID: 8176247
  Public Sub Page_Load(Source As Object, E As EventArgs)
         Dim ds As New DataSet
         Dim dsc As SQLDataAdapter
         DIM dsc = New SQLDataAdapter("SELECT CompanyName, ContactName, ContactTitle FROM Customers", _
                                                 "server=localhost;uid=sa;pwd=;database=Northwind;")
         dsc.FillDataSet(ds, "Customers")
         myDataGrid.DataSource = ds.Tables("Customers").DefaultView
         myDataGrid.DataBind()
    End Sub
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 9688062
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
0

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
There may be issues when you are trying to access Outlook or send & receive emails or due to Outlook crash which leads to corrupt or damaged PST file. To eliminate the corruption from your PST file, you need to repair the corrupt Outlook PST file. U…

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question