************* .NET

BreteVeswep

New Member
My frustration levels are peeking.<BR><BR>The following code excerpt is driving me mad. It works fine, but every time, I try and make it a DSN connection it fails with a<BR>'Could not find installable ISAM. ' error<BR><BR>All I am trying to do is display the results.<BR><BR>PS, the DSN value is vglsbs_data<BR><BR><%@ Page Debug="True" %><BR><%@ Import Namespace="System.Data" %><BR><%@ Import NameSpace="System.Data.OleDb" %><BR><BR><html><BR><script language="VB" runat="server"><BR><BR> Sub Page_Load(sender As Object, E As EventArgs) <BR><BR> Dim DS As DataSet<BR> Dim MyConnection As OleDbConnection<BR> Dim MyCommand As OleDbDataAdapter<BR><BR> MyConnection = New OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA Source=C:Documents and SettingsMark AntellDesktopProjectssbsdbvglsbs_data.mdb;Persist Security Info=False")<BR> MyConnection.Open<BR> MyCommand = New OleDbDataAdapter("select * from CliAddress", MyConnection)<BR><BR> ds = new DataSet()<BR> MyCommand.Fill(ds, "CliAddress")<BR><BR> MyDataGrid.DataSource=ds.Tables("CliAddress").DefaultView<BR> MyDataGrid.DataBind()<BR> End Sub<BR><BR></script><BR><BR><body><BR><BR> <h3><font face="Verdana">DataGrid Control</font></h3><BR><BR> <ASP:DataGrid id="MyDataGrid" runat="server"<BR> Width="700"<BR> BackColor="#ccccff" <BR> BorderColor="black"<BR> ShowFooter="false" <BR> CellPadding=3 <BR> CellSpacing="0"<BR> Font-Name="Verdana"<BR> Font-Size="8pt"<BR> HeaderStyle-BackColor="#aaaadd"<BR> EnableViewState="true"<BR> /><BR><BR></body><BR></html><BR><BR>Please help before .UNIX becomes a more tempting offer than .NETWhat you have wrote is a DSN-less connection.<BR><BR>MyConnection = New OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA Source=C:Documents and SettingsMark AntellDesktopProjectssbsdbvglsbs_data.mdb;Persist Security Info=False")<BR><BR>Does your database have a pasword?<BR>If so add this to the connection string where MyDbPassword is your databases password.<BR><BR>"Jet OLEDB:Database Password=MyDbPassword;" <BR><BR>If you want to use a DSN then change "DATA Source=C:Documents and SettingsMark AntellDesktopProjectssbsdbvglsbs_data.mdb;" to "DSN=vglsbs_data;"<BR><BR>Aaron<BR>>If you want to use a DSN then change "DATA Source=C:Documents and <BR>>SettingsMark AntellDesktopProjectssbsdbvglsbs_data.mdb;" <BR>>to "DSN=vglsbs_data;" <BR><BR>This *will not* work in ASP.NET, as far as I can see. Scott Mitchell and I e-mailed about this earlier this morning, and nither one of us knows of a way to use a DSN via System.Data.Oledb.<BR><BR>If you want to use a DSN, you have to use the Microsoft.Data.Odbc namespace, which does not come installed with the .NET framwork paackage. You can get it from<BR>http://msdn.microsoft.com/downloads<BR><BR>Once you have installed this assembly, you can use a DSN via an ODBC connection, as below.<BR><BR>OdbcConnection("DSN=YourDSN")<BR>If anyone *has* figured out how to use a DSN in an OleDb to ODBC conenction via the System.Data.OleDb namespace, we would love to see it, so please share. :-)
 
Back
Top