Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,152,901 members, 7,817,665 topics. Date: Saturday, 04 May 2024 at 04:44 PM

Vb.net Alert - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Vb.net Alert (837 Views)

I Need A Help To Write A Simple Login Form Using Vb.net / Vb.net Crystal Report & Dataset / Post Ur Vb 6.0 Questions Here (2) (3) (4)

(1) (Reply)

Vb.net Alert by bigafees: 9:36am On Jul 29, 2009
I'M NEW PROGRAMMER ON VB.NET BUT GOO IN VB6
PLS CAN ANYBODY IN THE HOUSE ASSIST ME ON HOW I CAN CONNECT MS ACCESS TO VB.NET

THANK U
Re: Vb.net Alert by solomonope(m): 2:03pm On Jul 29, 2009
here is a c# example, the logic is the same and u have access to the same classes on the .net frame work.


using System;
using System.Data;
using System.Data.OleDb;
public class Program
{
static OleDbConnection m_Connection;
static OleDbCommand m_Command;
static OleDbDataReader m_reader;
static void Main()
{
m_Connection = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\Solomon\Documents\nairaland.accdb;Mode=ReadWrite;Persist Security Info=False"wink;
m_Command = new OleDbCommand();
try
{
m_Command.Connection = m_Connection;
m_Command.CommandText = "Select * from threads";
m_Command.Connection.Open();
m_reader = m_Command.ExecuteReader();
Console.WriteLine("ThreadName\t\tThreadDescription"wink;
while (m_reader.Read())
{

Console.WriteLine("{0} \t\t{1}", m_reader[1], m_reader[2]);
}
Console.WriteLine("Press Enter to Continue"wink;
Console.ReadKey();


}
catch (OleDbException ew) { }
finally
{
if (m_Connection.State == ConnectionState.Open)
{
m_Connection.Close();
}
}

}
Re: Vb.net Alert by Gomez(m): 3:55pm On Jul 29, 2009
Here is the same code in VB.NET


Imports System
Imports System.Data
Imports System.Data.OleDb
Public Class Program
Shared m_Connection As OleDbConnection
Shared m_Command As OleDbCommand
Shared m_reader As OleDbDataReader
static void Main()
{
m_Connection = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\Documents\nairaland.accdb;Mode=ReadWrite;Persist Security Info=False"wink
m_Command = New OleDbCommand()
Try
m_Command.Connection = m_Connection
m_Command.CommandText = "Select * from threads" ["Threads" will be your table name]
m_Command.Connection.Open()
m_reader = m_Command.ExecuteReader()
Console.WriteLine("ThreadName\t\tThreadDescription"wink
While m_reader.Read()

Console.WriteLine("{0} \t\t{1}", m_reader(1), m_reader(2))
End While
Console.WriteLine("Press Enter to Continue"wink
Console.ReadLine()


Finally
If m_Connection.State = ConnectionState.Open Then
m_Connection.Close()
End If
End Try

End Class

Take care

(1) (Reply)

How Can I Implement A Local Area Networking For My App / How To Recover A Hacked Yahoo Account / Are There Nairaland APIs (Application Programming Interfaces) That We Can Use?

(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. 10
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.