string connstr="Server=192.168.1.1;uid=sa;pwd=sa;database=master";
SqlConnection conn=new SqlConnection(connstr);

解决方案 »

  1.   

    Private Sub GetData()
            Dim cmd As New SqlCommand("select classid,classname,startyear,isfinish,employeename from class left join employee on class.employeeid=employee.employeeid where class.schoolid=@schoolid and isfinish='否'order by classid desc", cnn)
            cmd.Parameters.Add("@schoolid", Session("schoolid"))
            Dim adapter As New SqlDataAdapter(cmd)
            Dim dst As New DataSet
            Try
                adapter.Fill(dst)
                dgdClass.DataSource = dst.Tables(0).DefaultView
                dgdClass.DataBind()
            Catch ex As Exception
                Response.Write(ex.Message)
            Finally
                cnn.Close()
            End Try
      

  2.   

    dim cmd as adodatasetcommandasp.net没有"adodatasetcommand"吗?为什么会报错?请高手指点迷津!用vb.net怎么开发?
      

  3.   

    msdn里面的例子,应该可以满足你的要求了
    Public Shared Sub Main() 
        Dim nwindConn As SqlConnection = New SqlConnection("Data Source=localhost;" & _
                                                           "Integrated Security=SSPI;Initial Catalog=northwind")    Dim catCMD As SqlCommand = nwindConn.CreateCommand()
        catCMD.CommandText = "SELECT CategoryID, CategoryName FROM Categories"    nwindConn.Open()    Dim myReader As SqlDataReader = catCMD.ExecuteReader()    Do While myReader.Read()
          Console.WriteLine(vbTab & "{0}" & vbTab & "{1}", myReader.GetInt32(0), myReader.GetString(1))
        Loop    myReader.Close()
        nwindConn.Close()
      End Sub
      

  4.   

    1,建议楼主还是先看看Ado.net方面的知识
    2,VB.net跟C#开发也差不多的
      

  5.   

    上面说的没错,应该是ado.net的问题
    dim cmd as adodatasetcommandasp.net没有"adodatasetcommand"吗?为什么会报错?请高手指点迷津!用vb.net怎么开发?adodatasetcommand应该是sqlcommane不过有些书写的ado和sql不同,与数据库有关。
    对吗?
      

  6.   

    //asp.net没有"adodatasetcommand"吗?为什么会报错?
    你的书可能是Beta版的,里边用的名称和标准版有些是不同的,建议换一本:)
    以前的using System.Data.ADO应改为using System.Data.OleDb;
    using System.Data.Sql;应改为using System.Data.SqlClient;
    以前的datasetcommand现在叫dataAdapter,所以呀,换本书看吧
      

  7.   

    starrain95(随风2003) 你说的一点都没错!!!!太好了.按上边的修改定能解决问题吧?好的.我回去试试看.