473,404 Members | 2,213 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

How to Connect Controls via ADO to Ms Access By Codes

I can manually connect controls on a Form to an Access Database through ADO. Some authors say that it is better to do the connection through codes if your database is large.

I have tried to connect controls on a Visual Basic Form via ADO by codes many times and have never been able to.

Can any member help me, please?

Thanks in advance.

Akinyemi.
Dec 9 '06 #1
1 1793
I can manually connect controls on a Form to an Access Database through ADO. Some authors say that it is better to do the connection through codes if your database is large.

I have tried to connect controls on a Visual Basic Form via ADO by codes many times and have never been able to.

Can any member help me, please?

Thanks in advance.

Akinyemi.
Hi,
Try using this code
Dim conn1 as String
conn1 = "Provider=MSDASQL.1;Persist Security Info=False;Extended Properties="
conn1 = conn1 + Text1.Text 'Set Text1.text = double ticks (")
conn1 = conn1 + "DBQ="
conn1 = conn1 + databasefileactualpath
conn1 = conn1 + "yourdatabasename.mdb;"
conn1 = conn1 + "Driver={Microsoft Access Driver (*.mdb)};DriverId=25;FIL=MS Access;FILEDSN="
conn1 = conn1 + databasefileactualpath
conn1 = conn1 + "createdsn file.dsn;MaxBufferSize=2048;MaxScanRows=8;PageTime out=5;PWD=password(if exists input here);SafeTransactions=0;Threads=3;UID=admin;UserC ommitSync=Yes;"
conn1 = conn1 + Text1.Text 'Set Text1.text = double ticks (")
conn1 = conn1 + ";Initial Catalog="
conn1 = conn1 + databasefileactualpath
conn1 = conn1 + "yourdatabasename without file extension"

Adodc1.ConnectionString = conn1

Set the following properties in Adodc control
Command Type: 2 - adCmdTable
CursorType: 1- adOpenKeySet
Password: if password exists for the database, input here.


Regards,
Padhu
Dec 12 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: T. Wintershoven | last post by:
Hello, Although i write programs in VB for a while now, i've allways used the datacontrol and MS-Access DBs for data storage and never (and i mean never) used SQL. I lookt in many sample...
33
by: Savas Ates | last post by:
in asp page im getting this error how can i solve it.. yesterday the codes work but i setup visual studio 6.0 now it doesnt works..
7
by: Bil Muh | last post by:
Esteemede Developers, I would like to Thank All of You in advance for your sincere guidances. I am developing a software using Visual C++ .NET Standard Edition with Windows Form (.NET)...
16
by: TD | last post by:
This is the code under a command button - Dim ctl As Control For Each ctl In Me.Controls If ctl.BackColor <> RGB(255, 255, 255) Then ctl.BackColor = RGB(255, 255, 255) End If Next ctl
3
by: cocla | last post by:
I try to connect to server using following codes: (smart device application) Socket s=new Socket(); try { s.connect(host);//host is an object of IPEndPoint class } catch (SocketException) {
2
by: iwdu15 | last post by:
hey, i was wondering if 1) anyone could tell me whats wrong with my code, i did a little fixing to the msdn version fo this, or 2) how to make a simple program that will connect and listen for...
2
by: c676228 | last post by:
Hi, I created a group of user controls in an aspx form. which is as follow: <body> <form id="Form1" method="post" runat="server"> <SUBWAY:PEOPLEINFO id="Peopleinfo0" runat="server"...
14
by: Marcus | last post by:
I have a function that simply returns TRUE if it can connect to a particular Sql Server 2005 express, or FALSE if it cannot. I am getting some strange error codes returned when the computer that...
5
by: Nathan Sokalski | last post by:
I am attempting to send an email using ASP.NET 1.1's Mail.SmtpMail.Send() method. My code contains all of the following: Dim mailmsg As New Mail.MailMessage Mail.SmtpMail.SmtpServer =...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.