SqlDataAdapter Problem Overload

J

jm

This code:

<%@ Page Language="vb" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.Odbc" %>
<%@ import Namespace="System.Data.SqlClient"%>
<script runat="server">

Sub Page_Load(Sender As Object, E As EventArgs)

Dim DS As DataSet
Dim MyCommand As SqlDataAdapter

Dim MyConnection As Odbc.OdbcConnection
Dim sConnString As String = "Dsn=test;" & _
"Uid=root;" & _
"Pwd="



MyConnection = New Odbc.OdbcConnection(sConnString)

MyCommand = New SqlDataAdapter("select * from users",
MyConnection)

DS = new DataSet()
MyCommand.Fill(ds, "users")

MyDataGrid.DataSource=ds.Tables("users").DefaultView
MyDataGrid.DataBind()
End Sub

</script>
<html>
<head>
</head>
<body>
<h3><font face="Verdana">Simple Select to a DataGrid
Control</font>
</h3>
<ASP:DataGrid id="MyDataGrid" EnableViewState="false"
HeaderStyle-BackColor="#aaaadd" Font-Size="8pt" Font-Name="Verdana"
CellSpacing="0" CellPadding="3" ShowFooter="false" BorderColor="black"
BackColor="#ccccff" Width="700" runat="server"></ASP:DataGrid>
</body>
</html>


Gives this error:


Compiler Error Message: BC30518: Overload resolution failed because no
accessible 'New' can be called with these arguments:

Source Error:



Line 19: MyConnection = New Odbc.OdbcConnection(sConnString)
Line 20:
Line 21: MyCommand = New SqlDataAdapter("select * from users",
MyConnection)
Line 22:
Line 23: DS = new DataSet()


What does this mean? Why doesn't it like these arguments? How can I
fix it? Thank you for any help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top