| | I'm am trying to create a script so that visual basic 6 can interact with mysql Any ideas? |
|
|
|
You need to download MyVbQL project, from Planet Source Code, and compile it into a dll, or include it directly in your project, and easily use it as a class... Here's the link on Planet Source Code -> MyVbQL Or a new project site: VbMySQL Library has 4 classes: MYSQL_CONNECTION -> Provides connectivity to MySQL server MYSQL_RS -> Provides access to recordsets(tables) within MySQL database MYSQL_FIELD -> Provides access to fields within MySQL table MYSQL_ERR -> Provides access to error object, to see if any MySQL errors occured You can access tables fields same as you would access a variable declared as a Collection: Recordset.Fields("fieldname").Value Recordset.Fields(fieldindex).Value As the library is open source, when you get the source code, you will see all the properties of all four classes in the project... I'd recommend downloading it from PSC, as VbMySQL site didn't have a download available when I last looked at it... Here's a small example how I use this great library in my projects: CODE 'Here I create a variable named MySQL as a new connection object for MySQL Global MySQL As New MySQL_CONNECTION Private Function MySQL_Connect() As Boolean Dim res_MySQL As MYSQL_CONNECTION_STATE MySQL_Connect = False res_MySQL = MySQL.OpenConnection("server", "username", "password", "database", 3306, CLIENT_COMPRESS) If res_MySQL = MY_CONN_OPEN Then MySQL_Connect = True End Function ' Query -> MySQL query to execute. ' CloseRS -> Optional. Close recordset created after executing Query. ' RS -> Optional. Reference to externaly created variable, declared as MYSQL_RS. If not closed, it will be available to the program after the query is executed. ' lAffected -> Optional. Numer of rows affected after te Query. Public Sub SQLQuery(ByVal Query As String, Optional ByVal CloseRS As Boolean = False, Optional ByRef RS As MYSQL_RS, Optional ByRef lAffected As Long) Dim ERR As MYSQL_ERR Set RS = MySQL.Execute(Query, lAffected) Set ERR = MySQL.Error If ERR.Number <> 0 Then ' Handle any eventual errors that occurred during MySQL query End If ERR.Clear Set ERR = Nothing If CloseRS Then RS.CloseRecordset Set RS = Nothing End If End Sub Public Sub DisplayData(ByRef RS As MYSQL_RS) Dim p_Date As Date If RS.RecordCount > 0 Then p_Date = FromUnixTime(RS.Fields("date").value) lblDate.Caption = Format(p_Date, "dd. mmmm yyyy") txtTitle.Text = UTF8.UTF8ToANSI(RS.Fields("title").value) txtDescription.Text = UTF8.UTF8ToANSI(RS.Fields("describe").value) txtContent.Text = UTF8.UTF8ToANSI(RS.Fields("content").value) End If RS.CloseRecordset Set RS = Nothing End Sub If you need any help with this code, feel free to contact me... Happy connecting
thanks for that post, i will also find this handy. i could use this in a future project of mine
thanks, Xp10r3r_3X
Question
Mysql In Visual Basic Are codes for linking vb 6.0 form to all versions of sql same? -question by asogol Question Mysql In Visual Basic Are codes for linking vb 6.0 form to all versions of sql same? -question by asogol If I understood you correctly, you want to link entire form to a database object? Well, that is not possible with MySQL library I mentioned above, but I suppose it could be done using ADO... Only, I don't like to use ADO, so I can't help you with that, but at least I can give you that pointer - look for it using ADO... Although, I don't see why one wouldn't use this library, it's small, fast, and it works... As far as I know it connects to MySQL 4.x and 5.x, possibly even 3.x... It all depends on MySQL maintaining libmysql.dll compatibility, and keeping all the functions within... It does take some programming to display and update the data from MySQL, but hey, you can't have it all with zero effort...
about View,function,preceddure
Mysql In Visual Basic I want to develop one project in vb and mysql and now I want to use view,function and procedure so plese help me and give me a code if it is possible thanking you -question by Ashish Dudhatra
Recent Queries:-
Keywords : mysql, visual, basic, mysql, visual, basic
(4) CAn anyone give me a guide on VB? I've decided to learn it and I need something to work with.... Simple Visual Basic program to aid in making guides (3) I wrote this about 3 months ago for a different forum (Runescape Forums, one I'm currently a (2) hi friends, i have some good complete and incomplete projects in visual basic 6.0. and now i is it possible to encrypt a http request? (2) I've used VB before which is why im asking this in the VB forum and not any other forum because (5) Well currently I have the working model edition for Visual Basic 6.0 which won't allow me to How does it work? (2) Hey, I'm using (sorta) Visual Basic Express Edition Beta 2 (long name, eh?), but I can't Adding lines to a textbox without delete (13) I need help with Visual Basic 6.0 and adding lines to a textbox without deleting any previous (6) Hi I have used vb to link to an access 2003 database using the adodc component- (connection string Please, Help!! (1) Hello Everyone... I need to put in the images table of the DB, 10 pictures of 60kb each one, when i STUDENTS ONLY (11) Visit THE SPOKE for your free copy of Visual Studio.NET..... Minimize to Tray (4) This example will "minimize" your program to the system tray when you click on a button, and restore Removing List Duplicates (2) Removing duplicates from lists is something that you'll have to put up with if you're, say, Downloading Images from a webpage (2) Here's how to grab an image off the internet easily. You'll need an Inet on your form to do Looking for mysql, visual, basic, mysql, visual, basic
|
|
![]() Mysql In Visual Basic - Mysql in visual basic |
| ADD REPLY / Got an Opinion! | Remove these ADs! | RAPID SEARCH! | Free Web Hosting | [X] |
|
Express your Opinions, Thoughts or Contribute more info. to help others. Ask your Doubts & Queries to get answers, So that "Together We can help others!" |
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP. | 500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE |
|