Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,155,075 members, 7,825,394 topics. Date: Sunday, 12 May 2024 at 01:12 PM

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# (1255 Views)

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

(1) (Reply) (Go Down)

How Do I Read Integer Values From Oledb In C# by darealez(m): 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(m): 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)

Apply For Facebook Software Development Program / Breaking News. " Donald Trump Arrested' Virus Warning : Snopes.com / Learn Wordpress, Angular Js And Bootstrap For Web Design/development

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 38
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.