Questions tagged [oledbdatareader]

OleDbDataReader Class provides a way of reading a forward-only stream of data rows from a data source.

OleDbDataReader Class provides a way of reading a forward-only stream of data rows from a data source.

System.Object
. System.MarshalByRefObject
. . System.Data.Common.DbDataReader
. . . System.Data.OleDb.OleDbDataReader

Namespace: System.Data.OleDb
Assembly: System.Data (in System.Data.dll)

To create an OleDbDataReader, you must call the ExecuteReader method of the OleDbCommand object, instead of directly using a constructor.

Before you close the OleDbConnection, first close the OleDbDataReader object. You must also close theOleDbDataReader object if you plan to resuse an OleDbCommand object.For example, you cannot retrieve output parameters until after you call Close.

http://msdn.microsoft.com/en-us/library/system.data.oledb.oledbdatareader.aspx

175 questions
0
votes
1 answer

C# OleDbDataReader

How to change this: public void Charge(string bankaccountnumber, decimal moneyamount) { foreach (Bankaccount bankaccountInProcess in bankaccount) { if (bankaccountnumber == bankaccountInProcess.Bankaccountnumber) …
leripe
  • 3
  • 1
  • 3
0
votes
1 answer

C# read excel cannot get the value

I can read all of the value except 'one'. This is my code: OleDbConnection oledb_con = new OleDbConnection(strCon); oledb_con.Open(); OleDbCommand oledb_com = new OleDbCommand("SELECT * FROM [sheet1$]", oledb_con); OleDbDataReader oledb_dr =…
Edison
  • 79
  • 1
  • 13
-1
votes
1 answer

OleDbDataReader and bulkcopy.WriteToServer do not write to table

My script does not insert any data in the database table and it does not throw any error either. The server, database and table names are correct. The workbook is selected using filedialog (hence correct filepath) and the worksheet name seems…
ProtoVB
  • 773
  • 5
  • 12
  • 24
-1
votes
1 answer

VB.net OleDbDataReader doesn't return wanted values

OleDb in VB.net only returns the first column I don't know where I've gone wrong, stared at it for 2 hours straight and tried 150 different variations. Don't know where the error is that makes it not return any other fields than the first one. And…
-1
votes
1 answer

MysqlDataReader.Read stuck on the last record and doesnt EOF

i confused why mySqlDataReader.Read stuck on the last record and doesnt EOF .. Here's my private function for executeSql : Private Function executeSQL(ByVal str As String, ByVal connString As String, ByVal returnRecordSet As Boolean) As Object …
XMozart
  • 879
  • 2
  • 10
  • 22
-1
votes
2 answers

OleDbDataReader inside a OleDbDataReader

I have 2 Tables. I want to get all ID's from Table1, and while I am inside the frist OleDbCommand I want to check if the ID is in Table2 too. I tried this: using (OleDbCommand cmd = new OleDbCommand("SELECT ID FROM Table1 WHERE NAME=:NAME) { …
user576914
  • 199
  • 1
  • 8
  • 22
-1
votes
5 answers

Displaying bool value as Yes or No

I am quering a database and assigning the values to an object which I serialize and display in a report. Thing is the bool variables are displayed in the report as true or false. How can get the values to be displayed as "Yes" or "No". This is my…
Arianule
  • 8,811
  • 45
  • 116
  • 174
-2
votes
1 answer

oledbdatareader not accessible outside the function in C#.net code

I have the below code which used to work until i recently updated the function to return true or false.But suddenly the object objReader stopped being accessible outside the function.I have declared in the beginning of the class as private static…
krrishna
  • 2,050
  • 4
  • 47
  • 101
-3
votes
2 answers

Use of unassigned local variable c# using OleDbDataReader

I am having a problem and have been banging my head aginst a wall... I keep getting a "Use of unassigned local variable" when I call "dbReader = dbCommand.ExecuteReader();" it says the Use of unassigned local variable 'dbCommand'. Would someone…
user1475623
-8
votes
1 answer

Why does this code compile in one solution but not in another?

I have this code in one solution, and it works fine: private readonly List departments = new List(); . . . private void LoadDepartments(string serialNum) { string dbContext =…
1 2 3
11
12