Logo 
Search:

Asp.net Forum

Ask Question   UnAnswered
Home » Forum » Asp.net       RSS Feeds

Web Matrix & MS Access

  Asked By: Juana    Date: Mar 30    Category: Asp.net    Views: 1926
  

I'm checking out the new tool to develop in ASP but having a slight
problem. Can't seem to connect to my MS Access database. What gives.


Sub btnRetrieve_Click(sender As Object, e As EventArgs)

Dim Conn As New ADODB.Connection
Dim sql As String

Conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Persist Security Info=False;" & _
"Data Source = c:\Translation\database\Translation.mdb"

Conn.Open

sql = "SELECT DocumentText FROM Document WHERE DocumentTitle
='Test2'"

Set RSTranslation = Conn.Execute (sql)
txtUntrans.text = RSTranslation

End Sub

Share: 

 

3 Answers Found

 
Answer #1    Answered By: Ana Silva     Answered On: Mar 30

There is other stuff wrong but I notice this right off
the bat:
sql  = "SELECT DocumentText FROM Document WHERE
> DocumentTitle
> ='Test2'"

Should be:
WHERE DocumentTitle=" & "'" & "Test2" & "'"

Also, not sure if Classic ADO works and you need to
play with what your storing the results in and how to
use it.

 
Answer #2    Answered By: Dustin Dean     Answered On: Mar 30

The line that he was using (below) would work just fine.


sql = "SELECT DocumentText FROM Document WHERE DocumentTitle ='Test2'"

 
Answer #3    Answered By: Ruairidh Anderson     Answered On: Mar 30

I was thinking that Test2 was a
control, but then, goes to show how much I know. In
.NET you can assume the default property of a control,
you have to reference it, like, Me.Test2.Text.

correct?

 
Didn't find what you were looking for? Find more on Web Matrix & MS Access Or get search suggestion and latest updates.




Tagged: