asp.net 提示说OleDbconnection未定义类型 15
PublicSubbind()DimmystrAsString=_ConfigurationManager.AppSettings("myconnstring")Dimm...
Public Sub bind()
Dim mystr As String = _
ConfigurationManager.AppSettings("myconnstring")
Dim myspl As String = "SELECT student.学号,student.姓名," & _
"score.课程名,score.分数,student.班号 " & _
"FROM student,score " & _
"WHERE student.学号 =score.学号 " & _
"ORDER BY student.学号"
Dim myconn As New OleDbconnection()
myconn.ConnectionString = mystr
myconn.Open()
Dim myds As New Dataset()
Dim myda As New OleDbDataAdapter(mysql, myconn)
myda.Fill(myds, "student")
GridView1.DataSource = myds.Tables(0)
GridView1.DataBind()
myconn.Close()
End Sub
打得一个事件可一直提示里面OleDbconnection,Dataset未定义类型,跟书上打的一样,也不知道到底哪里错了 展开
Dim mystr As String = _
ConfigurationManager.AppSettings("myconnstring")
Dim myspl As String = "SELECT student.学号,student.姓名," & _
"score.课程名,score.分数,student.班号 " & _
"FROM student,score " & _
"WHERE student.学号 =score.学号 " & _
"ORDER BY student.学号"
Dim myconn As New OleDbconnection()
myconn.ConnectionString = mystr
myconn.Open()
Dim myds As New Dataset()
Dim myda As New OleDbDataAdapter(mysql, myconn)
myda.Fill(myds, "student")
GridView1.DataSource = myds.Tables(0)
GridView1.DataBind()
myconn.Close()
End Sub
打得一个事件可一直提示里面OleDbconnection,Dataset未定义类型,跟书上打的一样,也不知道到底哪里错了 展开
展开全部
第一:有买有添加引用
system.data
system.configuration
第二: Dim myspl As String =
Dim myda As New OleDbDataAdapter(mysql, myconn)
myspl != mysql
Imports System.Configuration
Imports System.Data.OleDb
Module Module1
Sub Main()
End Sub
Public Sub bind()
Dim mystr As String = _
ConfigurationManager.AppSettings("myconnstring")
Dim mysql As String = "SELECT student.学号,student.姓名," & _
"score.课程名,score.分数,student.班号 " & _
"FROM student,score " & _
"WHERE student.学号 =score.学号 " & _
"ORDER BY student.学号"
Dim myconn As New OleDbConnection()
myconn.ConnectionString = mystr
myconn.Open()
Dim myds As New DataSet()
Dim myda As New OleDbDataAdapter(mysql, myconn)
myda.Fill(myds, "student")
GridView1.DataSource = myds.Tables(0)
GridView1.DataBind()
myconn.Close()
End Sub
End Module
system.data
system.configuration
第二: Dim myspl As String =
Dim myda As New OleDbDataAdapter(mysql, myconn)
myspl != mysql
Imports System.Configuration
Imports System.Data.OleDb
Module Module1
Sub Main()
End Sub
Public Sub bind()
Dim mystr As String = _
ConfigurationManager.AppSettings("myconnstring")
Dim mysql As String = "SELECT student.学号,student.姓名," & _
"score.课程名,score.分数,student.班号 " & _
"FROM student,score " & _
"WHERE student.学号 =score.学号 " & _
"ORDER BY student.学号"
Dim myconn As New OleDbConnection()
myconn.ConnectionString = mystr
myconn.Open()
Dim myds As New DataSet()
Dim myda As New OleDbDataAdapter(mysql, myconn)
myda.Fill(myds, "student")
GridView1.DataSource = myds.Tables(0)
GridView1.DataBind()
myconn.Close()
End Sub
End Module
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询