Results 1 to 32 of 32

Thread: Almost Impossible!

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2002
    Posts
    296

    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

  2. #2
    Frenzied Member macai's Avatar
    Join Date
    Jul 2001
    Location
    Napanoch NY
    Posts
    1,228
    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.
    Luke

  3. #3
    PowerPoster
    Join Date
    Aug 2000
    Location
    IN SILENCE
    Posts
    6,441

    Well

    I do not understand all the confudtion here...

    VB Code:
    1. Dim CNN As New ADODB.Connection, RST As New ADODB.Recordset
    2.    
    3.    ' CREATE CONNECTION
    4.    
    5.     CNN.Open GBLSTRCONSTR & GBLDBASE1
    6.    
    7.     RST.Open "Select * from EMPLOYEE_LIST WHERE " & _
    8.         "ISNULL(TERMDATE)=TRUE", _
    9.         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....

  4. #4
    Frenzied Member macai's Avatar
    Join Date
    Jul 2001
    Location
    Napanoch NY
    Posts
    1,228
    Yeah, but writing the connection string is a pain in the ass! Its
    almost like learning another programming language.
    Luke

  5. #5
    PowerPoster
    Join Date
    Aug 2000
    Location
    IN SILENCE
    Posts
    6,441

    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....

  6. #6

  7. #7
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    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.

  8. #8
    Frenzied Member macai's Avatar
    Join Date
    Jul 2001
    Location
    Napanoch NY
    Posts
    1,228
    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:
    1. Dim x As DB
    2. x.OpenDB "C:\myDB.mdb"
    3. x.SetDB Table, x, y, Text
    4. Msgbox x.GetDB(Table, x, y, Text)
    Somebody please explain why such advanced connection strings
    are required...?
    Luke

  9. #9
    Junior Member
    Join Date
    Oct 2002
    Posts
    27

    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...)

  10. #10
    Frenzied Member macai's Avatar
    Join Date
    Jul 2001
    Location
    Napanoch NY
    Posts
    1,228
    Yes, but why is it necesary to be so complex?
    Luke

  11. #11
    Addicted Member
    Join Date
    May 2002
    Location
    FlyingOffice
    Posts
    178
    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....

  12. #12
    Frenzied Member macai's Avatar
    Join Date
    Jul 2001
    Location
    Napanoch NY
    Posts
    1,228
    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****?
    Luke

  13. #13
    Addicted Member
    Join Date
    May 2002
    Location
    FlyingOffice
    Posts
    178
    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 !!

  14. #14
    Member
    Join Date
    Oct 2000
    Location
    Europe
    Posts
    52
    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.

  15. #15
    Member
    Join Date
    Oct 2000
    Location
    Europe
    Posts
    52
    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.

  16. #16

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2002
    Posts
    296
    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

  17. #17
    Addicted Member Halon's Avatar
    Join Date
    Oct 2002
    Location
    under desk choking on rage
    Posts
    228

    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

  18. #18

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2002
    Posts
    296
    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

  19. #19
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    You can show the DataLink dialog easy enough, make an ocx or addin from that if that is what you mean.

    VB Code:
    1. Private Sub Command1_Click()
    2.     'make a reference to 'Microsoft OLE DB Service Component 1.0 Type Library'
    3.     'and your favorite ado resource
    4.     Dim dl As DataLinks
    5.     Set dl = New DataLinks
    6.     Dim cnnStr As String
    7.    
    8.     'create a connection string
    9.     cnnStr = dl.PromptNew
    10.     MsgBox cnnStr
    11.    
    12.     Dim cnn As ADODB.Connection
    13.     Set cnn = New ADODB.Connection
    14.     cnn.ConnectionString = cnnStr
    15.        
    16.     'edit a connection string
    17.     Dim ret As Boolean
    18.     ret = dl.PromptEdit(cnn)
    19.     If ret = True Then
    20.         MsgBox cnn.ConnectionString
    21.     End If
    22.    
    23.     Set dl = Nothing
    24.     Set cnn = Nothing
    25. End Sub

  20. #20
    Frenzied Member Shawn N's Avatar
    Join Date
    Dec 2001
    Location
    Houston
    Posts
    1,631
    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.
    Please rate my post.

  21. #21

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2002
    Posts
    296
    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

  22. #22
    Addicted Member nota141's Avatar
    Join Date
    Feb 2000
    Location
    The place down there under everyone else.
    Posts
    224
    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)

  23. #23
    Frenzied Member macai's Avatar
    Join Date
    Jul 2001
    Location
    Napanoch NY
    Posts
    1,228
    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!!
    Luke

  24. #24
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    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.

  25. #25
    Frenzied Member macai's Avatar
    Join Date
    Jul 2001
    Location
    Napanoch NY
    Posts
    1,228
    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!
    Luke

  26. #26

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2002
    Posts
    296
    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

  27. #27
    Frenzied Member Shawn N's Avatar
    Join Date
    Dec 2001
    Location
    Houston
    Posts
    1,631
    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.
    Please rate my post.

  28. #28

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2002
    Posts
    296
    I'd ther use an OCX created by a VBF person
    Kevin Carpenter
    Currently Working in the CAOS (CA Operating System) Group

  29. #29
    Frenzied Member macai's Avatar
    Join Date
    Jul 2001
    Location
    Napanoch NY
    Posts
    1,228
    Originally posted by carp
    I'd ther use an OCX created by a VBF person
    So, should i start working on it soon?
    Luke

  30. #30
    Let me in .. techyspecy's Avatar
    Join Date
    Aug 2002
    Location
    Back to VBF.
    Posts
    2,456
    Do not have a clue what this is all about.
    Working with Databases + difficult = ????????
    What would you work with then. Writing Calculator programs ???

  31. #31
    Frenzied Member macai's Avatar
    Join Date
    Jul 2001
    Location
    Napanoch NY
    Posts
    1,228
    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.
    Luke

  32. #32
    Let me in .. techyspecy's Avatar
    Join Date
    Aug 2002
    Location
    Back to VBF.
    Posts
    2,456
    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
  •  



Click Here to Expand Forum to Full Width