473,398 Members | 2,113 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,398 software developers and data experts.

Where To Write The Connection String

chandru8
145 100+
Hi everybody

Can anyone suggest me where to write the connection string
because am writing the connection string in each form load closing it in form_unload

the problem is when i want to change the path mean i need to change the in change

is there any alternative

thanks in advance
Apr 22 '08 #1
3 1231
debasisdas
8,127 Expert 4TB
write that in a module or can use the load event of MDI form for the purpose.
Apr 22 '08 #2
chandru8
145 100+
I Have Written The Connection Open In The Module
For Executing The Query I Used Set Module1.rs = Connection.execute(string )

Is It Correct

NOW I TRIED WRITTING INT THE MDI FORM
BUT THE QUERY WHICH I WROTE IN THE FORM IS NOT WORKING
------------------------MDI FORM
DIM objCon As New ADODB.Connection
DIM rs As New ADODB.Recordset
DIM strSql As String

Private Sub MDIForm_Load()
objCon.ConnectionString = "Provider = Microsoft.jet.oledb.4.0;Data source = C:\Crd.mdb"
objCon.Open
End Sub

Private Sub MDIForm_Unload(Cancel As Integer)
objCon.Close
Set objCon = Nothing
End Sub
------------------------FORM
strSql = "SELECT * FROM Login INNER JOIN MappingStatus ON Login.UserName = MappingStatus.Username WHERE (((Login.UserName)='" & txtUserName.Text & "'));"
Set rs = objCon.Execute(strSql)
Apr 22 '08 #3
debasisdas
8,127 Expert 4TB
declare the connection in module.

open /close in form.

remove the semicolon from SQL statement.
Apr 22 '08 #4

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

Similar topics

3
by: divya | last post by:
Hi, I have a table tblbwday with 2 fields Name and Birthday.I have written this script for displaying evryday names of the people on that day. <% set objConn...
0
by: woollymammoth | last post by:
I can't assign a MS SQL Server table record value to a simple VB variable, should be an easy thing. Sample SQL Server table has the data in the record as a char(30) string, the column for that record...
1
by: woollymammoth | last post by:
I can't assign a MS SQL Server table record value to a simple VB variable, should be a really easy thing. Sample SQL Server table has the data in the record as a char(30) string, the column for that...
0
by: Buddy Home | last post by:
Hello, I'm trying to upload a file programatically and occasionally I get the following error message. Unable to write data to the transport connection: An established connection was aborted...
3
by: Buddy Home | last post by:
Hello, I'm trying to upload a file programatically and occasionally I get the following error message. Unable to write data to the transport connection: An established connection was aborted...
1
by: DaveF | last post by:
Any Ideas as to this error message. I am trying to learn using ms sql server 7.0 Below is the code I am using for an update to a MS Sql Database. <%@ Language=VBScript %> <% Option Explicit...
0
by: masterdweb | last post by:
Hello All, First post here ... :-) I read so many articles/tutorials about this "simple" method to retrieve data from an excel sheet and did everything by the book, however, it does not work...
0
by: vishnu | last post by:
Hi, Am trying to post the data over https and am getting error in httpwebresponse.getResponseStream.Please help me to get rid of this issue. Here is the message from immediate window ...
0
by: kuguy | last post by:
Hi all, I'm new to the forums, so I hope this isn't in the wrong place... I have that "Software caused connection abort: socket write error" exception error that i've never meet before. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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.