Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,195,592 members, 7,958,825 topics. Date: Thursday, 26 September 2024 at 04:01 AM |
Nairaland Forum / Science/Technology / Programming / Vb.net Alert (866 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" 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" while (m_reader.Read()) { Console.WriteLine("{0} \t\t{1}", m_reader[1], m_reader[2]); } Console.WriteLine("Press Enter to Continue" 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" 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" While m_reader.Read() Console.WriteLine("{0} \t\t{1}", m_reader(1), m_reader(2)) End While Console.WriteLine("Press Enter to Continue" Console.ReadLine() Finally If m_Connection.State = ConnectionState.Open Then m_Connection.Close() End If End Try End Class Take care |
(1) (Reply)
Need A Personal Java Tutor / Vb6 Compilation/software Building / Software Enginneering Or Developing
(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. 8 |