Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 sql problems from visual basic

Author  Topic 

sendoh
Starting Member

12 Posts

Posted - 2005-07-02 : 02:16:27
hi all!
what's wrong with this,visualbasic link in MSaccess>>>>>>>>>
dim r as adodb.recordset
dim c as adodb.connection
private sub_command()

r.open "select*from table1 where name = '"& text1.text &"'",c,adopendynamic
r.open


there's an error on my sql,please help me

deep

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-07-02 : 02:24:41
You did not connect to your database using connection string c

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

sendoh
Starting Member

12 Posts

Posted - 2005-07-04 : 06:28:37
why?but i've been always use this variable for my connection string!!!please any brighter idea??????????????please help me!!!!!


deep
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-07-04 : 06:30:21
Post your connecting string and where did you declare that?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

sendoh
Starting Member

12 Posts

Posted - 2005-07-04 : 07:13:38
dim c as adodb.connection
dim r as adodb.recordset
private sub cmd1_click()
set c = new adodb.connection
c.connectionstring = "provider blah blah"c.open
set r =new adodb.recordset
r.open " SELECT * FROM table1 where name ='" & text1.text &"'", c, adopendynamic
r.open
if r.BOF and r.EOF then

msgbox "not found",search"
end if
r.("fieldname") = text1.text
end sub

this is my error

runtime error '3709'

the connection cannot be used to performed this operation.it's either closed or invalid in this context.

hope so!!!!!!

deep
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-07-04 : 07:19:09
Try one of these

r.open " SELECT * FROM table1 where name ='" & text1.text &"'", c, adopendynamic, adLockOptimistic

or
Set r =c.Execute("SELECT * FROM table1 where name ='" & text1.text &"'")



Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

Hyukevain
Yak Posting Veteran

66 Posts

Posted - 2005-07-05 : 07:08:11
1. Try Case Sensitive Connection String. Use ADODC to help you generate the Connection String and don't forget to check "Allow save password" so the connection string will include your password.
2. Try to use Client base recordset (rs.CursorLocation = adUseClient)
3. Try to open the recordset by using the connectionString, not the adodb.connection object (rs.open "bla bla", "provider blah blah", adOpenStatic, adLockReadOnly

Hope this can help.
Go to Top of Page

sendoh
Starting Member

12 Posts

Posted - 2005-07-06 : 02:43:14
thanks....

deep
Go to Top of Page
   

- Advertisement -