A Conversation for The H2G2 Programmers' Corner
A Visual Basic 7.0(.NET)-problem. Your assistance please...
TowelMaster Started conversation Sep 9, 2003
Hi to all,
I have the following problem:
In VB 7.0(hereafter referred to as .NET) I need to make an initial setup to connect to a database(MSAcces for now), with which I can automatically link data in the database to a datagrid in my form.
For this I need to create a OleDB-connection, then add an OleDbAdapter and then define an OleDataset in mijn appication. The first step is there, I have a connection with my database-file. however, in my sourceview I get the errormessage "Type OleDbConnection is not defined" and at the moment I don't really know what to do about it. I may have to declare namespaces or import some stuff, but my declarations are not accepted and underlined to indicate a syntax-error.
It's a shame that I'm stuck here now because yesterday I managed to connect to a remote AS/400-database. I can see all the fields in my remote database so I'm in business as far as that is concerned. This looks to me like not a connectionproblem but like a source-code probleem.
Any help is appreciated because I need to get my knowledge of basic databaseaccess in order before I can go on building applications.
Thanx in advance for any advice you can give me,
TM.
A Visual Basic 7.0(.NET)-problem. Your assistance please...
TowelMaster Posted Sep 9, 2003
More info : none of the Ole-statements are recognized, i.e. OleDbConnection, OleDbCmd and OleDbDataAdapter. So it stinks like I left out some namespace. Thing is that it's not easy to find the proper one...
This is the beginning of the source :
Private Sub OleDbConnection1_InfoMessage(ByVal sender As System.Object, ByVal e As System.Data.OleDb.OleDbInfoMessageEventArgs) Handles OleDbConnection1.InfoMessage
Dim bab5Conn As OleDbConnection = New OleDbConnection("Provider=SQLOLEDB;Data Source=localhost;" & _
"Integrated Security=SSPI;Initial Catalog=Babylon5")
Dim selectCMD As OleDbCommand = New OleDbCommand("SELECT Babylon5Id, Filmtitel, Waardering FROM Babylon5", bab5Conn)
selectCMD.CommandTimeout = 30
Dim bab5DA As OleDbDataAdapter = New OleDbDataAdapter
bab5DA.SelectCommand = selectCMD
Dim bab5DS As DataSet = New DataSet
bab5DA.Fill(bab5DS, "Customers")
End Sub
A Visual Basic 7.0(.NET)-problem. Your assistance please...
TowelMaster Posted Sep 9, 2003
"Any help is appreciated because I need to get my knowledge of basic databaseaccess in order before I can go on building applications."
One small thing : I do know my DB2-databases by heart, having worked on the AS/400 for years. And SQL-statements are no problem whatsoever either of course.
A Visual Basic 7.0(.NET)-problem. Your assistance please...
DoctorMO (Keeper of the Computer, Guru, Community Artist) Posted Sep 9, 2003
If I ever sell my soul and are forced into .Net I know were to come for help... I'm not sure that are many researchers that are that good at .Net, not that it's bad, just that it's quite new.
-- DoctorMO --
A Visual Basic 7.0(.NET)-problem. Your assistance please...
TowelMaster Posted Sep 17, 2003
Yup, indeed. Nice looking package(am I allowed to say that? ). I have solved this problem. I am now aware that - as I'm using an MSAccess database, I will have to start paying more attention to my database-design. If you do not configure your keyfields etcetera properly, you will get problems when .NET creates the SQL-statements in the sourcecode.
Lotsa other problems still though... I'll get back to this shortly.
TM.
Key: Complain about this post
A Visual Basic 7.0(.NET)-problem. Your assistance please...
More Conversations for The H2G2 Programmers' Corner
Write an Entry
"The Hitchhiker's Guide to the Galaxy is a wholly remarkable book. It has been compiled and recompiled many times and under many different editorships. It contains contributions from countless numbers of travellers and researchers."