₦airaland Forum

Welcome, Guest: Register • Login • With Google • Trending • Recent • New

Stats: 3,344,205 members, 8,510,646 topics. Date: Friday, 30 October 2026 at 06:53 PM

Toggle theme

How Do I Read Integer Values From Oledb In C# - Programming - Nairaland

Nairaland Forum › Science/Technology › Programming › How Do I Read Integer Values From Oledb In C# (1434 Views)

1 Reply (Go Down)

How Do I Read Integer Values From Oledb In C# by darealez(op): 7:17am On Dec 10, 2015
Using access database(Oledb) in C#, I've being able to read string values from the database using the
While(Reader.read)
{
String name = reader.getstring(0);
}
but it ain't working for integer values "ID" .
I tried using reader.getint16(0) all to no avail.
Re: How Do I Read Integer Values From Oledb In C# by Nobody: 7:04pm On Dec 10, 2015
okay this I how to access Ms access db


using System;
using System.Data;
using System.Data.OleDb;
public class Connect {
public static void Main () {
String connect = "Provider=Microsoft.JET.OLEDB.4.0;data source=.\\Students .mdb" ;
OleDbConnection con = new OleDbConnection(connect);
con.Open();
Console.WriteLine( "List of male students database" );
con.Close();
}
}





The file blah.md you should copy it from your acess database . and give a the specific data you want .
Re: How Do I Read Integer Values From Oledb In C# by Nobody: 7:14pm On Dec 10, 2015
Re: How Do I Read Integer Values From Oledb In C# by darealez(op): 9:57pm On Dec 10, 2015
Finally got it
Int32 da=reader.GetInt32(0);
worked!

Tnks(@all)
Re: How Do I Read Integer Values From Oledb In C# by prof30(m): 6:30pm On Dec 11, 2015
Using access database(Oledb) in C#, I've being able to read string values from the database using the
While(Reader.read)
{
String name = reader.getstring(0);
}
but it ain't working for integer values "ID" .
I tried using reader.getint16(0) all to no avail.

try
while(reader.read()){

String number = reader.getint32(1).tostring();
textbox1.text = number;
}

if it did not work then change the string data type to int..... that is

int number =.......
1 Reply

Integer Types Should Inherit From ... • Integer: ICT Training And Job • Creating UWP Application In C# Or C++ (xaml) • 2 • 3 • 4

Need To Open The File • What Can I Do With Fortran Programming • Get Unlimited Access To Lynda.com Tutorials, Premium Account For Just 1k