|
-
Oct 22nd, 2002, 08:40 PM
#1
Thread Starter
Hyperactive Member
Almost Impossible!
Ok, Here it is... One of the most hardest think in VB to do (In my opinion) is connecting to a MySQL database and running queries and getting data back! ITS SOOO HARD. I know a few people on these forums are VB/MySQL masters and can work with it real good....Why not make an OCX for us people that JUST CANT DO IT!
Kevin Carpenter
Currently Working in the CAOS (CA Operating System) Group
-
Oct 22nd, 2002, 09:02 PM
#2
Frenzied Member
I know, really. SQL and Access and DBs are a pain in the ass. I
write simple DB formats for my needs in that preticular
program...and its alot easier than learning how to enumerate an
access database table list thing or whatever.
-
Oct 22nd, 2002, 09:07 PM
#3
PowerPoster
Well
I do not understand all the confudtion here...
VB Code:
Dim CNN As New ADODB.Connection, RST As New ADODB.Recordset
' CREATE CONNECTION
CNN.Open GBLSTRCONSTR & GBLDBASE1
RST.Open "Select * from EMPLOYEE_LIST WHERE " & _
"ISNULL(TERMDATE)=TRUE", _
CNN, adOpenKeyset, adLockOptimistic
GBLSTRCONSTR and GBLDBASE1 are global varaibles that hold the connection string to my database, and the path to the database, respectively. Once you learn it, it's kinda easy...
Remaining quiet down here !!!
BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....
-
Oct 22nd, 2002, 09:14 PM
#4
Frenzied Member
Yeah, but writing the connection string is a pain in the ass! Its
almost like learning another programming language.
-
Oct 22nd, 2002, 09:17 PM
#5
PowerPoster
Well
Once you have it written, it's fairly easy.
Here's one for Access...
Provider=Microsoft.Jet.OLEDB.4.0; Data Source=
Remaining quiet down here !!!
BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....
-
Oct 22nd, 2002, 09:30 PM
#6
Frenzied Member
For more connection string samples and information, try http://www.able-consulting.com/ado_conn.htm
-
Oct 22nd, 2002, 09:35 PM
#7
If you have a hard time making the connection string, you can use either the ADO DataControl or a DataLink. If its the control then just delete after you copy the connection out. Or download MZTOOLS, its the best addin for vb6 I've seen and it has a shell to the datalink dialog that just builds the connection string and then copies it to the clipboard so you can paste it right into your code. I use that to spped things up.
http://www.mztools.com
Its the 'ADO Connection String' option under 'Other Utilities' you'll see a screen shot of it on the webpage.
-
Oct 22nd, 2002, 09:47 PM
#8
Frenzied Member
I don't see why DBs has to be so damned complex. I mean its like why dont they make it simple? Just go
VB Code:
Dim x As DB
x.OpenDB "C:\myDB.mdb"
x.SetDB Table, x, y, Text
Msgbox x.GetDB(Table, x, y, Text)
Somebody please explain why such advanced connection strings
are required...?
-
Oct 22nd, 2002, 10:30 PM
#9
Junior Member
Why not use the objects, they simplify things....
Why not use the objects, they simplify things....
DAO and ADO are both very easy to use..
as for SQL, if you don't like it forget databases.
It really isn't that hard once you get used to it.
using the objects (conenctions) as mentioned above is the prefered way for experienced programmers, however the Objects are prefered if you plan to link to a one of the ADO / DAO aware GUI controls (ie: FlexGrid / dbGrid etc...)
-
Oct 23rd, 2002, 01:17 AM
#10
Frenzied Member
Yes, but why is it necesary to be so complex?
-
Oct 23rd, 2002, 01:30 AM
#11
Addicted Member
For Marketing, Image Boosting.
Make it looks so complicate to make programmer feel REALLY SOMETHING----> Sense Of Security
Truth should always be simple!!
ps. For example:
DP--> MIS--> EIS--> SCM-->ERP-->CRM-->PLM
To developers, they are only buzzword, the inside basically are still the same.
Sales Order, Purchase Order, Inventory etc....
-
Oct 23rd, 2002, 01:38 AM
#12
Frenzied Member
Originally posted by asj
For Marketing, Image Boosting.
Make it looks so complicate to make programmer feel REALLY SOMETHING----> Sense Of Security
Truth should always be simple!!
ps. For example:
DP--> MIS--> EIS--> SCM-->ERP-->CRM-->PLM
To developers, they are only buzzword, the inside basically are still the same.
Sales Order, Purchase Order, Inventory etc....
Exactly. why dosen't somebody write a DB format minus the
bull****?
-
Oct 23rd, 2002, 02:27 AM
#13
Addicted Member
Different People Need Different BULL**** !
Another Wonder ....
They said IIS or blah....blah will improve performance...
But back to basic, if ODBC don't pretend to be so smart, just GIGO,
pass the request to server,
and let server do it... even for syntax check
Then performance will be fastest.
Why IIS or so......
THEY SELL !!
-
Oct 23rd, 2002, 04:01 AM
#14
Member
I use this subroutine to connect to my SQL Server:
Public Sub Connect(Server As String, UID As String, Pwd As String, DB As String)
STR = "driver={SQL SERVER};server=" & Server
STR = STR & ";uid=" & UID & ";pwd="
STR = STR & Pwd & ";database=" & DB & ";dsn=;"
Set Connection = New ADODB.Connection
Connection.CommandTimeout = 5000
Connection.Open STR
End Sub
then I simply call the sub from my frmLogin Form:
Connect txtServer.Text, txtUserName.Text, txtPassword.Text, "MyDatabase"
Hope this helps
MartinLG
Tell me, and I will forget. Show me, and I will remember. Involve me, and I will care.
-
Oct 23rd, 2002, 04:02 AM
#15
Member
Forgot something:
public Connection as ADODB.Connection
public STR as string
MartinLG
Tell me, and I will forget. Show me, and I will remember. Involve me, and I will care.
-
Oct 23rd, 2002, 05:35 PM
#16
Thread Starter
Hyperactive Member
That does help...But how to I get data back now, and run quires? Got any subs for this 
PS. VBFORUM ADMIN's PLEASE LOOK INTO GETTING THE HACK FOR VBULLETIN SO WE CAN DO A QUICK REPLY LIKE AT http://forum.stripenine.com
Kevin Carpenter
Currently Working in the CAOS (CA Operating System) Group
-
Oct 23rd, 2002, 06:13 PM
#17
Addicted Member
Easy conn string creation
Don't know if this will help you but this is how i used to make connection strings.
1. Right click on desktop and create new text document
2. Open the document, Save As, drop down 'Save as types' make sure select 'All files'
3. CXhange 'File Name' to "test.udl"...name can be anything just make sure it has .udl extension
4. click ok, then close text file, should have a file on desktop called test.udl
5. double click it , click on provider tab and choose depending on DB you are using. Then click on Connection tab and fill in your login details and test your connection.
6. Once successful, click OK, will get a message saying you are saving as unencrypted text but we will delete later so just say OK
7. Now just drop the file into Notepad and you will see your ready made connection string
Seems long on instructions but i find it really helps me build strings. Just remember to delete this UDl so nobody gets their grubby hands on your details
Soylent Green tastes like chicken
-
Oct 23rd, 2002, 07:23 PM
#18
Thread Starter
Hyperactive Member
Err, Thats confusing.... I think someone really good with MySQL and VB should write an OCX...I think it'd be famous!
Kevin Carpenter
Currently Working in the CAOS (CA Operating System) Group
-
Oct 23rd, 2002, 08:30 PM
#19
You can show the DataLink dialog easy enough, make an ocx or addin from that if that is what you mean.
VB Code:
Private Sub Command1_Click()
'make a reference to 'Microsoft OLE DB Service Component 1.0 Type Library'
'and your favorite ado resource
Dim dl As DataLinks
Set dl = New DataLinks
Dim cnnStr As String
'create a connection string
cnnStr = dl.PromptNew
MsgBox cnnStr
Dim cnn As ADODB.Connection
Set cnn = New ADODB.Connection
cnn.ConnectionString = cnnStr
'edit a connection string
Dim ret As Boolean
ret = dl.PromptEdit(cnn)
If ret = True Then
MsgBox cnn.ConnectionString
End If
Set dl = Nothing
Set cnn = Nothing
End Sub
-
Oct 23rd, 2002, 08:47 PM
#20
Frenzied Member
Create a new text file wherever and change the extension to "udl". When you open it you can set a connection string's properties real simple. Once you're done, save it.
Change the extension back to "txt" and you'll have the connection right there.
I forgot what kind of software you have to have installed for this to work.
-
Oct 23rd, 2002, 09:14 PM
#21
Thread Starter
Hyperactive Member
Err, I started this thread becuase I wanted someone with great knowlage in ths area to make an OCX, not myself as you can show me as many examples as you want and i'll still be confused.
Kevin Carpenter
Currently Working in the CAOS (CA Operating System) Group
-
Oct 24th, 2002, 01:22 AM
#22
Addicted Member
i would just like to say that an ocx that does everything all ready exist "microsoft ado data control".
i use the "microsoft ado data control" to create my connection string.
On Error wake up and try again ;-)
___________________________
ICQ # 65392645
email - [email protected]
Visual Studio 6 ent with SP5 Running on XP with an AMD 1.2 ThunderBird with 512 MB RAM And a 120GB primary HDD (very sweet)
-
Oct 24th, 2002, 02:22 AM
#23
Frenzied Member
Originally posted by carp
Err, Thats confusing.... I think someone really good with MySQL and VB should write an OCX...I think it'd be famous!
TERD returns! I was writing an ActiveX DLL that was basically my
own DataBase format! Maybe i should continue writing it? THe
format was simple!!
-
Oct 24th, 2002, 02:57 AM
#24
I guess the jist of it is that the people who know how to work with ADO are saying there are already tools or that it'd be easier to learn how then to use another control to do it. Then you'd be confused on how to work the control. The thing of it is that there are different kinds of datasources and ADO works with most of them so it has to be fairly open ended to do that and that may make it more complex. I'm not trying to be difficult but learning the normal way of working with databases would take probably half the time of making a control that makes it easier. And the people that already know don't use a special control they just do it the normal way.
-
Oct 24th, 2002, 03:22 AM
#25
Frenzied Member
Originally posted by Edneeis
I guess the jist of it is that the people who know how to work with ADO are saying there are already tools or that it'd be easier to learn how then to use another control to do it. Then you'd be confused on how to work the control. The thing of it is that there are different kinds of datasources and ADO works with most of them so it has to be fairly open ended to do that and that may make it more complex. I'm not trying to be difficult but learning the normal way of working with databases would take probably half the time of making a control that makes it easier. And the people that already know don't use a special control they just do it the normal way.
Yeah, but the new people would just learn TERD (my DB
format...and yes, i was trying to be funny when i came up with
this a whiel back)...the purpose of Visual Basic is for things
to be Basic yet powerful. If we write our own data source,
with our own class module, we can just use THAT instead of
learning a scripting language on how to use them all!
-
Oct 24th, 2002, 05:14 PM
#26
Thread Starter
Hyperactive Member
I don't to use TERD, I want to use MySQL becuase I know MySQL with PHP and I like me apps to be web/computer format so they can be accessed from both places. I dont know TERD in PHP nor do I want to learn it.
Kevin Carpenter
Currently Working in the CAOS (CA Operating System) Group
-
Oct 24th, 2002, 06:39 PM
#27
Frenzied Member
Originally posted by carp
Err, I started this thread becuase I wanted someone with great knowlage in ths area to make an OCX, not myself as you can show me as many examples as you want and i'll still be confused.
Read a book.
-
Oct 24th, 2002, 08:27 PM
#28
Thread Starter
Hyperactive Member
I'd ther use an OCX created by a VBF person
Kevin Carpenter
Currently Working in the CAOS (CA Operating System) Group
-
Oct 25th, 2002, 06:31 AM
#29
Frenzied Member
Originally posted by carp
I'd ther use an OCX created by a VBF person
So, should i start working on it soon?
-
Oct 25th, 2002, 06:34 AM
#30
Let me in ..
Do not have a clue what this is all about.
Working with Databases + difficult = ????????
What would you work with then. Writing Calculator programs ???
-
Oct 25th, 2002, 06:48 AM
#31
Frenzied Member
Originally posted by techyspecy
Do not have a clue what this is all about.
Working with Databases + difficult = ????????
What would you work with then. Writing Calculator programs ???
The concept of a Database is wonderful...but ADO and MySQL are
complicated beyond need.
-
Oct 25th, 2002, 07:17 AM
#32
Let me in ..
Originally posted by macai
The concept of a Database is wonderful...but ADO and MySQL are
complicated beyond need.
They are complicated ........
Can't believe this. I always thought its the most easiest thing you could ever do with VB. Besides, VB is the dumbest language I have ever programmed with.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|