oledbdatareader

OleDB only returning DbNull, what have I done wrong?

I've got the following code: // personCount = 7291; correct value int personCount = (int)new OleDbCommand("SELECT COUNT(*) AS [count] FROM [Individual]", _access).ExecuteScalar(); List<Person> people = new List<Person>(); OleDbCommand personQuery = new OleDbCommand("SELECT * FROM [Individual]", _access); using (OleDbDataReader personR...

OleDbDataReader and asp.net

I'm writing a small asp.net app that uses an access db. I'm using a layered architecture and business objects. In my dataaccess class, I have tis method that returns all records by UserID: public static List<BilledeDetails> GetBillederByUserID(int userid) { using (OleDbConnection conn = new OleDbConnection(_connStrin...

Clearing OleDbDataReader parameters

Hi guys, In order to do my stuff, I query the database (Access) to see if my data is already there. So, I'm using a OleDbDataReader. Everything is fine at this moment. Next, depending on the result of my query, I'm doing an insert or and update. The problem is, this operation is using the same parameters (OleDbParameters) that I was us...

LIKE Command Problem using OLEDBREADER and MS Access

Odd one this... The following command returns what I would expect when I run it in query window in Access 2003: SELECT * FROM Train WHERE [Days] LIKE '*3*' However when I pass this into my C# code to run (returning an OleDbDataReader) I get nothing.I suspect it's something to do with the LIKE command (when I remove this I get rows). ...

Retrieving Data from the Database ASP.NET MVC + Oracle

Hello Friends, I have two tables Users (Userid, Name, PhoneNumber) Applications (ApplicationsId,UserId, ApplicationName, ActiveDate) Every user will have more than 1 application. In Nhibernate using lazy loading I can get the users data along with all the applications for every user. So, I used to do something like user.applications...

Read columns names issue with reader.GetName and OLEDB Excel provider

Hi, I have an issue to retrieve the columns names in an Excel sheet. I have an Excel sheet with only 3 cells in the first row with these 3 values: in A1: A in B1: B in C1: A.B.C When I try to execute my method the label shows: A,B,A#B#C And not: A,B,A.B.C My Code: protected void btnExecute_Click(object sender, EventArgs...

retrive value using OleDbDataReader

hi, Let us think my sql query is select customerDetials.custid,TestTable.col1 from CustomerDetails INNER JOIN TestTable on CustomerDetails.custid=TestTables.custid where CustomerDetails.custid>0 I wanna use OleDbDataReader to retive rows of this . I used this way while (dataReader.Read()) { string str= dataReader["custome...

Is there a way to force Microsoft.Jet.OLEDB to get date Columns in MM/DD/YYYY format from Excel?

Hi, I am having a problem with reading DateColumns from an excel sheet. Sometimes people use different date Formats and this brings a problem. Let's say when I expect 07/26/2010 from an Excel column I get "26-Jul-2010" because the user has changed its date format. I use Microsoft.Jet.OLEDB for reading the xls sheet into a DataTable. ...

Specified cast is not valid

SqlDataReader reader; string r="C:\\Users\\Shivam\\Documents\\"; if ((FileUpload1.PostedFile != null)&&(FileUpload1.PostedFile.ContentLength > 0)) { r += System.IO.Path.GetFileName(FileUpload1.PostedFile.FileName); } OleDbConnection oconn = ...