/ Forside / Teknologi / Udvikling / VB/Basic / Nyhedsindlæg
Login
Glemt dit kodeord?
Brugernavn

Kodeord


Reklame
Top 10 brugere
VB/Basic
#NavnPoint
berpox 2425
pete 1435
CADmageren 1251
gibson 1230
Phylock 887
gandalf 836
AntonV 790
strarup 750
Benjamin... 700
10  tom.kise 610
What is wrong with this code?
Fra : Erlend Stokkedal


Dato : 04-08-02 17:06

Below is the code that I use to connect to MS-SQL server, but when I run the
program I get this message:

"Compile Error. User defined type not defined" and it marks the first line
of code "RS As ADODB.Recordset"

Why? What is wrong?

Private Sub Command1_Click()
Dim RS As ADODB.Recordset
Dim strSql
Dim conStr
conStr = "Provider=SQLOLEDB.1;Password=abcd;Persist Security
Info=True;UID=sa;Initial Catalog=MYDB;Data Source=LOCAL"
strSql = "select * from users"


Set RS = New ADODB.Recordset
RS.CacheSize = 10
RS.CursorLocation = adUseClient

RS.Open strSql, conStr, adOpenDynamic, adLockOptimistic, adCmdText

If Not RS.EOF Then
txtInfo(0).Text = RS("brukernavn")
txtInfo(1).Text = RS("passord")
End If
End Sub




 
 
Harald Staff (04-08-2002)
Kommentar
Fra : Harald Staff


Dato : 04-08-02 20:11

You must set a reference to ADO.

HTH. Best wishes Harald

"Erlend Stokkedal" <erlestok@online.no> wrote in message
news:Ghc39.6098$sR2.108235@news4.ulv.nextra.no...
> Below is the code that I use to connect to MS-SQL server, but when I run
the
> program I get this message:
>
> "Compile Error. User defined type not defined" and it marks the first
line
> of code "RS As ADODB.Recordset"




Søg
Reklame
Statistik
Spørgsmål : 177552
Tips : 31968
Nyheder : 719565
Indlæg : 6408847
Brugere : 218887

Månedens bedste
Årets bedste
Sidste års bedste