Using asp.net
От | Molenda, Mark P |
---|---|
Тема | Using asp.net |
Дата | |
Msg-id | 424D6EA99E39D4118FA100508BDF097012A87D91@USCHM203 обсуждение исходный текст |
Список | pgsql-novice |
I want to use postgres as the back end to my asp page. I have a working version of .net framework and the microsoft odbcprovider for .net. What happens is That I get an error message saying ======================= Server Error in '/' Application. ERROR [01000] [Microsoft][ODBC Driver Manager] The driver doesn't support the version of ODBC behavior that the application requested (see SQLSetEnvAttr). Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: Microsoft.Data.Odbc.OdbcException: ERROR [01000] [Microsoft][ODBC Driver Manager] The driver doesn't support the version of ODBC behavior that the application requested (see SQLSetEnvAttr). Source Error: Line 16: Line 17: Dim ds as Dataset = new DataSet() Line 18: query.Fill(ds) Line 19: Line 20: myDataGrid.DataSource = ds ======================= Any help would be appreciated, I found maybe 20 versions of this sample code all over the internet but no explanation of why it doesn't work. My source is below, I use a real server name and password in the real code. ====================== <%@ Import Namespace="System.Data" %> <%@ Import Namespace="Microsoft.Data.Odbc" %> <HTML> <HEAD> <SCRIPT Language="VBScript" Runat="server"> Sub Page_Load(Source as object, e as EventArgs) Dim strconn as String = "Driver={PostgreSQL};srvr=myserver;Database=business;UID=postgres;PWD=somepa ssword;" Dim conn as ODBCConnection = new ODBCConnection(strconn) Dim strSQL as string = "SELECT * FROM status" Dim query as ODBCDataAdapter = New ODBCDataAdapter(strSQL, conn) Dim ds as Dataset = new DataSet() query.Fill(ds) myDataGrid.DataSource = ds myDataGrid.DataBind() End Sub </SCRIPT > </HEAD> <BODY> <FONT COLOR="Blue" FACE="Verdana" SIZE="2">select * from ads<BR><BR></FONT> <ASP:DataGrid ID="MyDataGrid" Runat="server" Font-Size="10pt" Font-Name="Verdana" /> </BODY> </HTML>
В списке pgsql-novice по дате отправления: