You have the .NET Framework on your local computer and you want to connect to a Microsoft Access database called database1.mdb located in the following folder on your hard disk: c:\database1.mdb. Here are the parameters to create this connection string:
Provider=Microsoft.Jet.OLEDB.4.0; Data Source=c:\database1.mdb;
OLE DB Provider for DB2 (from Microsoft)
For TCP/IP connections
oConn.Open = "Provider=DB2OLEDB;" & _
"Network Transport Library=TCPIP;" & _
"Network Address=xxx.xxx.xxx.xxx;" & _
"Initial Catalog=MyCatalog;" & _
"Package Collection=MyPackageCollection;" & _
"Default Schema=MySchema;" & _
"User ID=MyUsername;" & _
"Password=MyPassword"
For APPC connections
oConn.Open = "Provider=DB2OLEDB;" & _
"APPC Local LU Alias=MyLocalLUAlias;" & _
"APPC Remote LU Alias=MyRemoteLUAlias;" & _
"Initial Catalog=MyCatalog;" & _
"Package Collection=MyPackageCollection;" & _
"Default Schema=MySchema;" & _
"User ID=MyUsername;" & _
"Password=MyPassword"
ODBC Driver for Excel
oConn.Open "Driver={Microsoft Excel Driver (*.xls)};" & _
"DriverId=790;" & _
"Dbq=c:\somepath\mySpreadsheet.xls;" & _
"DefaultDir=c:\somepath"
ODBC Driver for MySQL (via MyODBC)
To connect to a local database (using MyODBC Driver)
oConn.Open "Driver={mySQL};" & _
"Server=MyServerName;" & _
"Option=16834;" & _
"Database=mydb"
To connect to a remote database
oConn.Open "Driver={mySQL};" & _
"Server=db1.database.com;" & _
"Port=3306;" & _
"Option=131072;" & _
"Stmt=;" & _
"Database=mydb;" & _
"Uid=myUsername;" & _
"Pwd=myPassword"
To connect to a local database (using MySQL ODBC 3.51 Driver)
oConn.Open "DRIVER={MySQL ODBC 3.51 Driver};" & _
"Server=myServerName;" & _
"Port=3306;" & _
"Option=16384;" & _
"Stmt=;" & _
"Database=mydatabaseName;" & _
"Uid=myUsername;" & _
"Pwd=myPassword"
Or
oConn.Open "DRIVER={MySQL ODBC 3.51 Driver};" & _
"SERVER=myServerName;" & _
"DATABASE=myDatabaseName;" & _
"USER=myUsername;" & _
"PASSWORD=myPassword;"
Showing posts with label basic. Show all posts
Showing posts with label basic. Show all posts
Saturday, August 29, 2009
Thursday, July 23, 2009
Use of basic keywords in c#
In C# base keyword is used to call the base class constructor and base class field.
First the values are received by the derived class constructor and then passed to the base class constructor.
See The Code
class A
{
int i;
A(int n, int m)
{
x = n;
y = m
Console.WriteLine("n="+x+"m="+y);
}
}
class B:A
{
int i;
B(int a, int b):base(a,b)//calling base class constructor and passing value
{
base.i = a;//passing value to base class field
i = b;
}
public void Show()
{
Console.WriteLine("Derived class i="+i);
Console.WriteLine("Base class i="+base.i);
}
}
class MainClass
{
static void Main(string args[])
{
B b=new B(5,6);//passing value to derive class constructor
b.Show();
}
}
OUTPUT
n=5m=6
Derived class i=6
Base class i=5
First the values are received by the derived class constructor and then passed to the base class constructor.
See The Code
class A
{
int i;
A(int n, int m)
{
x = n;
y = m
Console.WriteLine("n="+x+"m="+y);
}
}
class B:A
{
int i;
B(int a, int b):base(a,b)//calling base class constructor and passing value
{
base.i = a;//passing value to base class field
i = b;
}
public void Show()
{
Console.WriteLine("Derived class i="+i);
Console.WriteLine("Base class i="+base.i);
}
}
class MainClass
{
static void Main(string args[])
{
B b=new B(5,6);//passing value to derive class constructor
b.Show();
}
}
OUTPUT
n=5m=6
Derived class i=6
Base class i=5
Subscribe to:
Posts (Atom)