Re: ODBCDataReader dBase IV
From: Kevin Ghantous (anonymous_at_discussions.microsoft.com)
Date: 04/06/04
- Next message: NancyASAP: "import from text file, change rowstate"
- Previous message: Patrice: "Re: This code works though I don't understand why"
- In reply to: Paul Clement: "Re: ODBCDataReader dBase IV"
- Next in thread: Paul Clement: "Re: ODBCDataReader dBase IV"
- Reply: Paul Clement: "Re: ODBCDataReader dBase IV"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 6 Apr 2004 11:31:10 -0700
Paul,
Below you will find a code snippit. Now, one thing I was thinking about as I was gathering this snippit, I am storing the reader in an IDataReader type instead of the ODBCDataReader type. I am going to go ahead and post this code, but I will try to change the type to an ODBCDataReader. I will let you know what happens. -- My code is relatively the same, I simply have a different ConnectionString...
[Code]
ConnectionString: DRIVER={Microsoft dBase Driver (*.dbf)};DBQ=C:\Documents and Settings\ghantousk\Desktop\Ghantous\DATAFILE;DefaultDir=C:\Documents and Settings\ghantousk\Desktop\Ghantous;DriverId=277;MaxBufferSize=2048;PageTimeout=5;
Odbc.OdbcConnection dbConn = new Odbc.OdbcConnection(ConnectionString);
Odbc.OdbcCommand dbCmd = new Odbc.OdbcCommand("SELECT * FROM User WHERE LTrim(ID) = @ID",dbConn);
IDataReader dbReader;
dbCmd.Parameters.Add("@ID", "1234");
_connection.Open(); //Open Connection
dbCmd.Prepare(); //Pre-Compile Query
dbReader = dbCmd.ExecuteReader(CommandBehavior.CloseConnection);
if(dbReader.Read())
Response.Write(dbReader["LastName"].ToString());
dbConn.Close()
Thanks,
-Kevin
- Next message: NancyASAP: "import from text file, change rowstate"
- Previous message: Patrice: "Re: This code works though I don't understand why"
- In reply to: Paul Clement: "Re: ODBCDataReader dBase IV"
- Next in thread: Paul Clement: "Re: ODBCDataReader dBase IV"
- Reply: Paul Clement: "Re: ODBCDataReader dBase IV"
- Messages sorted by: [ date ] [ thread ]