Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  HOME    TRACKER    Visual Basic

Reading From Database

I got this so far:

VB Code:
Set DB = OpenDatabase(App.Path & "Stilo.mdb")  'Open the Contact table  Set RS = DB.OpenRecordset("SELECT * FROM Contact WHERE # = '" & 5 & "'") What do i do next?How do i read the value to a textbox?

View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Reading ADSI Database With VB && Store In SQL SERVER Database
This is first time I m looking for help in any VB forum I hope I can get some useful hint or help regarding my current problem. Let me describe in brief what we want:

We have one vb application which uses the MS-SQL Server Database. We want some changes in the login screen as per our new requirement.

What we want
1)We want to add one form which will show one button called ‘Update Users’ on clicking the button application will read the current users from the ADSI and store/update in the SQL-DATABASE(User Name and password in the existing table in our database).

2) When we will start the application system checks for the current windows user name and password if same user name and password exist in the MS-SQL Server database then there is no need to show login page but if the user name or password not in the database then prompt for the Login Screen

Please help me to find out how to read the ADSI Database using the VB Application email (


Reading Database
Hey guy I wanted to know how I could read the info like the password and username for a login for our program.

Reading A Database
give the code below why does label 8 +5 come up blank

While Not Data1.Recordset.EOF
If Data1.Recordset.Fields("Country Code").Value = Label3.Caption Then
Label8.Caption = Data1.Recordset.Fields("Country Name").Value
Label5.Caption = Data1.Recordset.Fields("National Anthem").Value
End If



Reading Of Database
Dear Beloved Friends.

I'm a kinda new in this VB programming, and most of my work is copy+paste :/

And yet again, im searching for help.

I've made a small simple program:

It's only function is to open Notebook and Paint, quete simple.

But i was wondering, if one of you guys could make me a program, quete the same, but the only differens would be:
Instead of reading the names and paths of the program, FROM the .EXE file (the project) it would be reading the paths and names from a database file,
like a .INI or excel file, or something 3rd, so i could change the programs, without using Visual Basic! Ö
Like: ID1 = Paint|C:WINDOWSSystem32MSPaint.exe - or something.

Is it possible, and could one of you beloved guys, make it for me and upload it?
To like, your hp, or megaupload, or stuff?

That would be SO appreciatet.

Best Regards
Frederik (Im from Denmark)

- P.S. Sorry for the bad english :/

Reading From A Database
I want to be able to read from a database and see if I have a customers information. How would I go about doing this? Here is the code I use to enter the information using a userform.
Private Sub cmdAdd_Click()

Dim iRow As Variant 'Declares arrays used for cell
Dim ws As Worksheet
Set ws = Worksheets("Random")
Dim ws2 As Worksheet
Set ws2 = Worksheets("Bartender File")
Dim iRow2 As Integer
iRow2 = 2

'find first empty row in database
iRow = ws.Cells(Rows.Count, 1) _
.End(xlUp).Offset(1, 0).Row

'check for a part number

If Trim(Me.cboTitle.Value) = "" Then
MsgBox "Please enter a Visitor Type", vbExclamation, "Customer Information"
Exit Sub
End If
If Trim(Me.txtFirstName.Value) = "" Then
MsgBox "Please enter a First Name", vbExclamation, "Customer Information"
Exit Sub
End If
If Trim(Me.txtLastName.Value) = "" Then
MsgBox "Please enter a Last Name", vbExclamation, "Customer Information"
Exit Sub
End If
If Trim(Me.txtTitle.Value) = "" Then
MsgBox "Please enter a Title", vbExclamation, "Customer Information"
Exit Sub
End If
If Trim(Me.txtCompany.Value) = "" Then
MsgBox "Please enter a Company", vbExclamation, "Customer Information"
Exit Sub
End If
If Trim(Me.txtAddress.Value) = "" Then
MsgBox "Please enter a Address", vbExclamation, "Customer Information"
Exit Sub
End If
If Trim(Me.txtCity.Value) = "" Then
MsgBox "Please enter a City", vbExclamation, "Customer Information"
Exit Sub
End If
If Trim(Me.cboState.Value) = "" Then
MsgBox "Please enter a State", vbExclamation, "Customer Information"
Exit Sub
End If
If Trim(Me.txtZipCode.Value) = "" Then
MsgBox "Please enter a ZipCode", vbExclamation, "Customer Information"
Exit Sub
End If
If Trim(Me.txtPhone.Value) = "" Then
MsgBox "Please enter a Phone #", vbExclamation, "Customer Information"
Exit Sub
End If
If Trim(Me.txtFax.Value) = "" Then
MsgBox "Please enter a Fax #", vbExclamation, "Customer Information"
Exit Sub
End If
If Trim(Me.txtEmail.Value) = "" Then
MsgBox "Please enter a Email Address", vbExclamation, "Customer Information"
Exit Sub
End If
If Trim(Me.txtCell.Value) = "" Then
MsgBox "Please enter a Cell #", vbExclamation, "Customer Information"
Exit Sub
End If
If Trim(Me.txtKTCContact.Value) = "" Then
MsgBox "Please enter a KTC Contact", vbExclamation, "Customer Information"
Exit Sub
End If
Unload Me

'copy the data to the database
ws.Cells(iRow, 1).Value = Me.cboTitle.Value
ws.Cells(iRow, 2).Value = Me.txtFirstName.Value
ws.Cells(iRow, 3).Value = Me.txtLastName.Value
ws.Cells(iRow, 4).Value = Me.txtTitle.Value
ws.Cells(iRow, 5).Value = Me.txtCompany.Value
ws.Cells(iRow, 6).Value = Me.txtAddress.Value
ws.Cells(iRow, 7).Value = Me.txtCity.Value
ws.Cells(iRow, 8).Value = Me.cboState.Value
ws.Cells(iRow, 9).Value = Me.txtZipCode.Value
ws.Cells(iRow, 10).Value = Me.txtPhone.Value
ws.Cells(iRow, 11).Value = Me.txtFax.Value
ws.Cells(iRow, 12).Value = Me.txtEmail.Value
ws.Cells(iRow, 13).Value = Me.txtCell.Value
ws.Cells(iRow, 14).Value = Me.txtKTCContact.Value

'going to Bartender File
ws2.Cells(iRow2, 1).Value = Me.txtFirstName.Value
ws2.Cells(iRow2, 2).Value = Me.txtLastName.Value
ws2.Cells(iRow2, 3).Value = Me.txtTitle.Value

'clear the data
Me.cboTitle.Value = ""
Me.txtFirstName.Value = ""
Me.txtLastName.Value = ""
Me.txtTitle.Value = ""
Me.txtCompany.Value = ""
Me.txtAddress.Value = ""
Me.txtCity.Value = ""
Me.cboState.Value = ""
Me.txtZipCode.Value = ""
Me.txtPhone.Value = ""
Me.txtFax.Value = ""
Me.txtEmail.Value = ""
Me.txtCell.Value = ""
Me.txtKTCContact.Value = ""


End Sub

Reading From A Database On The Web
I found out that my program is 16 megs big. Therefore, what I would like to do is place my database on the web. However, I'm not sure how to tell my vb program to read from my site. Can anyone help me?

Reading From A Database
How would I read information from a database? any and all help would be greatly appreciated.

- Zer0 -
The first law of computer programming: The user is a complete idiot.

Edited by - Zer0 on 12/8/2002 7:59:00 PM

Reading .pdb Database
Helo everyone, i have a problem on how to read .pdb database. My plan is to create a dll that create an odbc connection to read and edit any kind of database...

any help is deeply appreaciated.


Reading From Database
Hi All,

could some one please let me know how to open database(Access) and check for login name and password from the user table at runtime. I want to check for all the available users in the table.

Thanks and regards

Reading From A Database
ok i need to read from a database i have and then open outlook express and send an email to each of the people in the database depending on what the email address is in the database but i need this to happen when i push a button the stop when i push another one then if i push the button to start it i need to continue where it left of at plz help me ive tried a couple of things and they dont work

ActiveX Reading Database???
Can an ActiveX Control on a webpage make a connection to a SQL Database?

Thanks for any input...

Database Reading/displaying
Well i have another question for ya. I need to read my SKU, description, unit price and quanity-in-stock from the invemtory table in the database.

I need to be able to have an error when someone puts in a wrong SKU, same as if they put in letters for the quanity.

I will need it to display the description and unit price in a text box after it finds it on the database (after entering the SKU & unit price)

Thanks for your time,

Only Reading One Record From Database

i have written some code to connect to an access database using the jet engine.

The purpose of it is to read a table called "Accounts" and check the username and password which is put in the program with the username and password fields in the database.

I thought i had it sorted but i only had one record in the DB. when i put another record in the DB and try and login to the program. it only accepts the last records data in the table.


Account ID | Type | Username | Password
0001 |admin | sam | sam
0002 | admin | jack | jack

the program will only accept jack, jack as the username and password..

here is the code i have ::

Sub LoginCheck()


MyConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:SAMS FOLDER 2collegeDatabase projectgood.mdb;" 'TOOLS NEEDED FOR RETRIEVEMENT OF DATA FROM DATABASE

Set MyRecSet = MyConn.Execute("SELECT [Type], [Username], [Password] FROM Accounts") 'GET INFO FROM SPECIFIC FIELDS

Do Until MyRecSet.EOF
strName = MyRecSet.Fields.Item("Username").Value 'GIVING strName DATA
strPassword = MyRecSet.Fields.Item("Password").Value 'GIVING strPassword DATA
strType = MyRecSet.Fields.Item("Type").Value

varDbType = strType


End Sub
any ideas?

Writing To A Database While Reading From It.
Hi All,
I am reading from a database in order to display its contents using the following code.

VB Code:
Private Sub DisplayEventGrid(LogNumber As Integer)     'Populate the event log grid     Dim i As Long    Dim j As Long    Dim DisplayLog As Database                   'Data base for display purposes    Dim RequiredTable As TableDef                'Reference to required table in a database.    Dim EventFieldRecord As Recordset            'Reference to required event data entry within a field.     On Error GoTo LogLoad_Err        Set DisplayLog = OpenDatabase("Mydatabase.mdb")     'Open the required event data base     'Get event data    Set RequiredTable = DisplayLog.TableDefs("Events")    Set EventFieldRecord = DisplayLog.OpenRecordset("Events")        i = 1    If Not EventFieldRecord.EOF Then        Do While Not EventFieldRecord.EOF            If (bShowTodayOnly = True And EventFieldRecord.Fields(0).Value = Date) Or bShowTodayOnly = False Then                flxEvents.Rows = flxEvents.Rows + 1                For j = 0 To EventFieldRecord.Fields.Count - 1                    If Not IsNull(EventFieldRecord.Fields(j).Value) Then                        If j = 0 Then       'Date                            flxEvents.TextMatrix(i, j) = Format(EventFieldRecord.Fields(j).Value, "dd/mm/yy")                        ElseIf j = 1 Then   'Time                            flxEvents.TextMatrix(i, j) = Format(EventFieldRecord.Fields(j).Value, "hh:mm:ss")                        Else                            flxEvents.TextMatrix(i, j) = EventFieldRecord.Fields(j).Value                        End If                    End If                Next                flxEvents.TextMatrix(i, j) = Mid$(flxEvents.TextMatrix(i, 0), 7, 2) + Mid$(flxEvents.TextMatrix(i, 0), 4, 2) + Mid$(flxEvents.TextMatrix(i, 0), 1, 2) _                + Mid$(flxEvents.TextMatrix(i, 1), 1, 2) + Mid$(flxEvents.TextMatrix(i, 1), 4, 2) + Mid$(flxEvents.TextMatrix(i, 1), 7, 2)                i = i + 1            End If            EventFieldRecord.MoveNext            DoEvents        Loop    End If            EventFieldRecord.Close    DisplayLog.Close Exit Sub  LogLoad_Err:    'Error handling    If Err = 3343 Then      'Corrupted database.        Do While MessageBox(MDIFrmMain.hwnd, _            "Unable to display corrupted log.", _            "Corrupted Database Found", vbExclamation + vbOKOnly) = False            DoEvents        Loop    Else        DoEvents        Resume Next    End If    End Sub

The problem I have is that the database may be written to while I am reading from it.
This causes an error 3420 which gets trapped but unfortunately the database read does not then complete.

Any help would be appreciated.

Reading From File Vs Database
Hi guys!

This is my first post so go easy on me. :-)

I am currently thinking of developing an insurance agency management system. I work for an agency and see a need that isn't being filled by the typical solutions out there.

Typically, they require SQL Server as that is the primary database holding the data. I would like to not have a requirement to use SQL Server, as it is expensive and the users would have to purchase licenses, have a big enough server, etc...

Now here's the question, and I hope I don't sound crazy. Couldn't I just basically set up my own proprietary database, which would consist of a file (or multiple files) that gets(or get) read from?

I assume SQL is faster, but why? It could likely keep some recently accessed things in memory, but typically it reads from the hard drive as well, right? Obviously the whole thing can't be held in memory (which is faster than HD access). Maybe it is written in optimized code, and it's obviously written in C/C++, but that can't be THAT much of a speed difference.

All of the programs I have written in the past use custom text files on the HD. They all worked fine.

Other than the fact that I can't use handy SQL statements to querry the database (and must use some recursive search functions), what are any other reasons why I shouldn't just have my program read from / write to a file(or files) on the hard drive as opposed to a database like SQL?

Thanks for any help on this!

Reading Database Error !! Why?
Private Sub cmdSave_Click()
Dim TableName As String
Dim myDB As DAO.Database
Dim td As DAO.TableDef
Dim f As DAO.Field

On Error GoTo errhandler

Set myDB = DAO.OpenDatabase("C:infodb.mdb")
Set td = myDB.CreateTableDef(TableName)

'add the fields

Set f = td.CreateField("SNO", dbLong)

td.Fields.Append f

myDB.TableDefs.Append td


it stops running - it doesn t read the database file why???
Its in access 2000 format.

ActiveX Reading Database???
Can an ActiveX Control on a webpage make a connection to a SQL Database?

Thanks for any input...

Problems With Reading From A Database
everytime i run this code it crashes at "RS.allocated" ive check all spelling etc and this is how i usally read from a database and it works... i have recently upgraded VB6 to SP4 cud this be the problem

Private Sub Command2_Click()
Dim DB As Database
Dim RS As Recordset

Set DB = DAO.OpenDatabase("
Set RS = DB.OpenRecordset("employee")

MsgBox RS.allocated

End Sub

Generates Error:

"Complie Error:
Method or data member not found"

thanks in advance

Error Reading A Database From Cd
We are making an application that will read data from the cd .We're having a problem reading a ms access database from the cd. It keeps on displaying that the database has been exclusively opened by another user.
What seems to be the possible cause of this?

Reading From One Database And Writing To Another
I have task of extracting data from one SQL database and using this data to update a second database after doing some work on the data to make it fit in to the second database, I am thinking of using, but I am not sure if I can open 2 databases in the same time and read from one and write to the other, and the best way to do it, as you see any help is appreciated

Vb6 Reading Paradox 7 Database
Hi all,
I have been having problems opening Paradox 7 tables using DAO. I am now told DAO is not capable of this.

What is the best way to open/read/write Paradox 7 tables, many of which have names of 10 or so characters long.

I have been reading the tables by linking them through Access but would much prefer to read the tables direct.

Any pointers will be very much appreciated


Problem On Reading Database
dear all

    i am doing a stock tracking program and in the form, i have a addnew, stock in and stock out button. when user click on the stock in or stock out button, it will prompt out with a input box for the user to enter the value and all the transaction will automatically be updated in the database....
    now the problem is the after the updating is done, when i click on the navigation button, it prompt out with this error message : Row cannot be located for updating. Some values may have been changen since it was last read.
    i am using Data Environment designer for this program......
    any idea on how to solve this problem???
    thanx in advanced!!!

Reading DBF Database Files From VB
Hi everybody,

Is there anyone there who knows how to access a DBF datafile from the data environment for reading/writing/updating records contained within (or perhaps a provider which I can install to allow access...?

Any help would be appreciated

Reading Access2000 Database Using DAO And ADO
I am trying to read data from an access2000 databse using ADO and DAO. In my project I have included references to DAO 3.6 and ADO 2.1.

when I execute the following command , i get an error , unrecognized database format

Set tempDB = DBEngine.OpenDatabase("c:db.mdb")
where db.mdb was created in access2000. The statement works fine with access97 databases.

what should I do so that I am able to read/write data to both access97 and access2000 databases using ADo and DAO.

Reading A File && Saving To Database
How can i store the following file types to my database.
I want to store their contents & not the paths as they could change.

1. A text file
2. A Word file
3. An Excel File
4. An AutoCAD Drawing File

Reading And Making A Txt File Database

I'm trying to make a program for a online bussnius. You would:
Select a shop from the first dropdown boxBe able to view the item and prices all in a listbox with some having a scroll bar for shops that have alot of items
But in the text file lets say in the dropdown box my first thing is "RHQ WC" so the text file would be:

-First item - Price
-Second- Price

and so on then i have another shop so in the dropdown would have something else saying "RHQ Magic" so should i make a another txt file (so far we have 2: RHQ WC and RHQ Magic) and put the item and price thing?

Main Question (For all those i just confused): How would i program a txt file to be a price and item database

Reading A CSV File And Inserting Into Database
I have a CSV file with 21 columns and I need it to take this info and read each column of every row. Then Insert the info in the database or update the database depending on if the data matches. I can do all the checking of the database, but I am not sure how to read a .csv file in VB6.

Form Freezes While Reading Database
While I'm reading SQL database from VB form, my form freezes. After it has finished reading the data, it will work ok. It's not a real pain, since most of the time, it's will just take a short time, but sometimes it takes longer. Is there something I can do, so that while I'm reading data, I can also for example move the form around? Here's the code to read the SQL database:

sConn = "provider=SQLOLEDB;server=;uid=user;pwd=;database=Weath er"

Dim rs As New ADODB.Recordset, sql As String

sql = "SELECT * FROM Weather"

rs.Open sql, sConn, adOpenForwardOnly, adLockReadOnly, adCmdText
lblTemperatureValueCalc.Caption = rs!temp
lblDewPointValueCalc.Caption = rs!DewPoint
lblHeatIndexValueCalc.Caption = rs!HeatIndex
lblWindSpeedValueCalc.Caption = rs!WindSpeed
lblWindDirectionValue.Caption = rs!WindDir
lblSunrise.Caption = rs!Sunrise
lblSunset.Caption = rs!Sunset
m_WeatherCode = rs!WeatherCode
lblWeatherText.Caption = rs!Weather
lblTimeValue.Caption = rs!Time
lblHumidityValue.Caption = rs!Humidity & "%"

Set rs = Nothing

Problem Reading Read-only Database
hi everyone

i am building an application that has to run from cd. the access-database used by my app has set it's read-only flag to true because it is on a cd-rom.
My problem is that my application can't open the database when it's read-only. I get an error like: Microsoft Jet-database engine can't open database because it is exclusively opened by another user or because you haven't got access.
I am using: Set myDb = OpenDatabase(myDbName, , True)
There must be a rather simple solution but i can't seem to find it. Can anyone help me out?


Trouble Reading Data From Database
I have this code currently to read data from the database from one field for all the records and store the value from each record in one variable in a dynamic array.

Dim staff_Array() As Integer
Dim itemcount As Integer

itemcount = 0
Do Until HourData.Recordset.EOF
hour_value = Hours
itemcount = itemcount + 1

ReDim Preserve staff_Array(itemcount) As Integer
staff_Array(itemcount - 1) = hour_value


I was given some pseudo code to help me along to develop this. The HourData refers to my data control on the form which links to the database and the table within that.

Can anyone help me becuase when i run it i get an error object variable or with block variable not set and this highlights hourdata.recordset.movefirst.

I am really not sure what to do, could someone help me with this code or some code that will do what i need.

Problem Reading Image From Database
I have problem here. I have field name that contains the path location of image file. Some record did not contains image file. So I left empty the field name. I have problem to move the next record for the record did not contains image field. I got this error message, path file not found. I think it because the next record did not contains the image file,How to solve it for the field name that have not image file?


'move next record
If Not Pesttable.EOF Then
Command21.Enabled = True
Command22.Enabled = True
End If
If Pesttable.EOF Or Pesttable.BOF Then
MsgBox "Tiada record lagi"
Command21.Enabled = False
Exit Sub
End If
Text20.Text = Pesttable.Fields("PEST_ID").Value & ""
Text21.Text = Pesttable.Fields("Nama_Perosak").Value & ""
Text23.Text = Pesttable.Fields("SCIENTIFIC_NAME").Value & ""
Text24.Text = Pesttable.Fields("Tanda_Serangan").Value & ""
'Reading from Database into PictureBox
Picture2.Picture = LoadPicture(Pesttable.Fields(0))

Reading Data From Database Into Listview
Hi.. I am new to vb. May I know how to show the data from database into listview? for example: ID, Name, gender etc.. and then when i select a particular record from the listview, it will pass the id to me, so that i can proceed to the edit form. Do anybody have an idea on this? Thanks in advance..

Writing/Reading To Access Database
I am looking for help to write and read data to an access database, i have a form created in VB and i want to allow the user enter data to this form and it will be written to the access database.

can anyone help?

Protect Database From Reading In Another Aplications

I use Vb6 and I know that a database can be protected if the user try to read from the same aplication but how do I avoid that someone can read from another aplication my database?

Julio Cesar

Need Help With Saving And Reading Info From A Database.
I am creating a Lan Café kinda program I've got my server and client programs working fine but I now need to add some sort of username and password feature so I know whos logged in. I know nothing about how to use databases with vb and have read a few things on this forum but couldnt find anything that was what I was after. I need to be add new members for example First Name, Surname, UserName, Password so when the client tries to connect it will check to see if the username and password are valid.

hope this makes some sence and i understand there isnt going to be a simple answer



Reading From An Access Database Troubles...
First of all, let me describe my problem. I have an Access database which has all of the parts stored there (see fig 1.). What I am trying to do is just grab a few of the fields and placing them in a MSFledGrid. The fields I would like to grab are GoodID, CategoryID, Description, Part Number, Inches and MM. Also, using the below tutorial as an example, I would like to be able to modify the SQL statement with a little more ease. For example, say I have a combo box on this form. I select a category ID that I would like to view, then boom, the FlexGrid has the items only from that category ID.

Is this making sense at all? Below is what I have tried (and failed) using.

fig. 1
/ goodid / categoryid / description / partnumber / inches / mm / createdate / modifyby / modifydate /

• Tried this tutorial
          I have looked over and over the code, and I still can't seem to grasp it. I guess I need it described to me in "dummy" terms.

Thanks in advance,

David Mosher

Reading Data From MySql Database ?

I'm new to mysql,
and I need to read data from mysql database using VB6.
I found code to connect to database (I've installed MyODBC 3.51.06),
but I would appriciate some example on how to read data, e.g. populate datagrid control from database , or something similar ?

Hope you can show me some example or direct me to some tutorial.


VB6 DAO Database With Reading/writing Pictures
I am having problems storing pictures in a database. I am using the DAO data control. I have two forms, the main form and the browse form. I have one data control on each both with the same name. Is there an easier way to do this without that extra form and i cannot access the common control dialog option in references because I do not have admin rights at school. But if there is a way to solve my problem with the use of 2 forms I would appreciate it because I do most of my VB work at school.

Problem Reading A Table From An Open Database
I have managed so far to open my database, but the minute I try and link to my table with the following code:

Set testtable = testdatadb.OpenRecordset("mailing list")
Set testtable = testdatadb.OpenRecordset("SELECT * FROM [mailing list]")

I keep getting an error message saying the jet engine cant find the table. Is there something I'm missing? Can somebody run through with me the procedure of setting up a database in access 2000 as well, cause I use the wizard, and maybe I' m doing something wrong!

I'm not gonna give up, I'll get it right some day...... :-)

Reading Files From Windows And Make Database
I am trying to write a mp3 program to meet my needs. I have alot of friends who ask me for a copy of collection to see all the music I have as well as the artists. So far I have been typing each individual cd in by hand and I use a program I have to search them. I will get a list of music 4.7 gigs worth and burn it to a dvd. This way I start the program and search for an artist/song/album and I know what dvd it is located on. However I would like to be able to stop adding the stuff in by hand. Anyone have any code that will search a folder and take the first foldername as the artist, second folder name and the album, and each file inside and add it to the database? I will add the dvd it is on to the database myself but adding the songs etc will save alot of time. Preferably I want it to check to see if the cd is in the database, if it is then ignore it and move on. If it isn't then add it and move on. I appreciate any help I can get if you can add some code to it under the dropdown menu above exit.

Thanks Alot

Problem With Number/date Reading From Database!
this is my code:::

Dim myconn1 As ADODB.Connection
Dim myrecset1 As ADODB.Recordset
[b]Dim author As String[/b]

Set myconn1 = New ADODB.Connection
myconn1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:Program Fileslibrary managerand1.mdb;"

Set myrecset1 = myconn1.Execute("SELECT author FROM books")
Do Until myrecset1.EOF
author = myrecset1.Fields.Item("author").Value
List3.AddItem author

at this case it works! but when i want to load numbers i cant! i tried to dim no as integer but still it didnt help!
my problem is:
what do i have to change in order to load numbers or dates from database!
cause so far i can load only strings!

please help!

thanks in advance!

Reading Names Of Tables Stored On A Database.
Hi, I've wrote an application which stores data on a SQL Server. I need to port this app to another site on my work and I am writing a little program that generates the table structure needed on the new SQL Server using DDL. The problem is I don't have any idea on how to know if the tables that my program generates are already created on the server.

There is any way (using SQL) to read the existing table names on a determined database?

Thanks in advance.

Reading Data From Database && Adding To Combo
Is it possible to add all files from one field in a table to a combo box in vb?

Eg. I Have 20 motors in a table, I want to take the names of the motors (Motor_ID) and add these to a combo box?

Is that possible?

URGENTLY REQD!Reading From Access Database

Hi friends,
Just a small doubt.I am writing this code to call data from an access database into a vb6 form which has text boxes to fill in the data. I am entering the value of 1 field (here its called problem number) and when i press command button i want other data to automatically come in other text boxes(PName, Gname , etc).My code is as follws:
Option Explicit
Private conDB As New ADODB.Connection
Private rs As ADODB.Recordset
Private strQuery As String
Private Sub Form_Load()
Set conDB = New Connection
conDB.CursorLocation = adUseClient
conDB.Provider = "Microsoft.Jet.OLEDB.4.0"
conDB.Open App.Path & "Coles.mdb"
End Sub

Private Sub GetData_Click()
If IsNull(PID) Then
MsgBox "Please give a valid Name", vbCritical, "Not string name"
Exit Sub
strQuery = "Select F.ProductName, F.GroupName, F.StartTime, F.EndTime,F.ProblemDescription from TableData F where F.ProblemID = '" & CStr(PID) & "'"
End If
Set rs = New ADODB.Recordset
rs.Open strQuery, conDB, adOpenDynamic, adLockOptimistic

If rs.EOF Then
MsgBox "No valid record", vbInformation

PName = rs(0).Value
GName = rs(1).Value
SDT = rs(2).Value
EDT = rs(3).Value
PDesc = rs(4).Value
End If
Set rs = Nothing
End Sub

Could someone tell me what is wrong with this?Since its givin error on the line
rs.Open strQuery, conDB, adOpenDynamic, adLockOptimistic
saying no value given for one or more reqd parameters.
Thanks in advance!Its urgent.Please reply fast!anyone!

Reading An Online Access 2000 Database
I am trying to make an authorizing system for my application. It should connect to an online access 2000 database, located at The database has 2 fields in a table Auth. These are username and pass.

I want to search for a username wich the user specifies, and look it up in the database. Then i want to let the program read wich password belongs to the username, and compare it with the user specified password.

My problem is, I don't really have an idea where to start, and I also want to make it as safe as possible. Maybe i shoulduse Sha256, or something sort like.


Reading A Time And Writing A Field From A Database
Hi There. I hope this is the right forum.

Im making a program, and heres what I need one part to do...

I have a database with 'start time' and 'file location'

When the actual computer time reaches a matching 'start time' in the database, I need the program to write the 'file location' field from the same record in the database into a text box.

I would appreciate if someone could help me uot and give me some pointeres of how this could be achived.

Thank you.

Reading A Time And Writing A Field From A Database
Hi there,

Im making a program, and heres what I need one part to do...

I have a database with 'start time' and 'file location'

When the actual computer time reaches a matching 'start time' in the database, I need the program to write the 'file location' field from the same record in the database into a text box.

Ok.. basically.. this program will play media files according to the playlist - which is the database. each media file will play after each other.

The database is set out something like this..

StartTime File location
19:40:30 C:Mediaclip1.avi
19:41:05 C:Mediaclip2.avi
19:43:45 C:Mediaclip3.avi

so when the computer clock reaches a 'StartTime' listed it will copy the 'C:Mediaclip*.avi into a text box. It will continually do this in order of the database start times.

the computer maybe running 24hr's a day, with the database continually being added to -New records being added ie; for tommorows schedule.

I would appreciate if someone could help me out and give me some pointeres of how this could be achived.

Reading Specific Records From An Access Database
I am trying to retrieve specific records fomr an access database that I have, However the SQl query that I am using
some times thorws an error when it is executed
the error is : Syntax error (missing operator) in query expression

Here is the code that i am using:

            SQL = "SELECT * FROM MP3s WHERE Album = '" & Avalue & "'"
            rs.ActiveConnection = db
            rs.CursorType = ADODB.CursorTypeEnum.adOpenForwardOnly
            rs.LockType = ADODB.LockTypeEnum.adLockOptimistic

From testing and debugging, I have found that I only get the error if the variable Avalue contains an ' . Is there any way to get around this issue.

Thanks in advance,

Edited by - ZeroGravity on 5/26/2004 3:35:37 PM

Randomly Reading Records In A SQL Server Database.
I moved this topic from VB Newbies to VB & Databases. I believe this topic should have been started here.

The following code allows me to get to the record with the coded values.

conDH = New ADODB.Connection
    conDH.ConnectionString = _
    "Provider=msdasql.1;initial catalog=hudson;user id=sa;password=sysadmin;data source=dealsql"
    Set oRsDH = New ADODB.Recordset
    strSQLDH = "SELECT * FROM DealHist" & _
    " where (bipad = 12345) and (custno = '55555') and (issd = 0130) "

    oRsDH.Open strSQLDH, conDH.ConnectionString

 The sequel database has an index for each component.

bipad has an index file with a name of dealhistB
 custno has an index file with a name of dealhistC
 issd has an index file with a name of dealhistI

There is also an index file named dealhistCBI with all three fields indexed

There are a lot of records in the file and it takes a long time to get to the record needed.

I believe there is a statement to use the index to get to the record immediately. However, I have no idea how to code the necessary statements.

Does anyone have any ideas?




Copyright © 2005-08, All rights reserved