5,691,626 members and growing! (13,189 online)
Email Password   helpLost your password?
Database » Database » Databases     Intermediate

.NET MySQL Connexion V 1.2

By Romelard Fabrice (Alias F___)

Class Library for MySQL request
VB.NET 1.0, Win2K, WinXP, Windows, .NET, MySQL, ASP.NET, Visual Studio, VS.NET2002, Dev

Posted: 17 Jul 2003
Updated: 17 Jul 2003
Views: 96,601
Bookmarked: 22 times
Announcements
Loading...



Search    
Advanced Search
Sitemap
12 votes for this Article.
Popularity: 3.52 Rating: 3.26 out of 5
4 votes, 33.3%
1
0 votes, 0.0%
2
2 votes, 16.7%
3
1 vote, 8.3%
4
5 votes, 41.7%
5

Introduction

This is a class library in VB.NET made for access on MySQL databases. You can use this library without creating functions for working on the databases.

For using this library, you must install :

and the

In this library, you have 3 classes:

  • ManipStringForMySQL: This class modifies the string for the SGBD
  • MySQL_Requettes: This class makes the request on the SGBD
  • MySQL_Utils : This class makes tests on the data of the SGBD

Visual Studio project screenshot

An example of the function with a dataset holding the results of the query:

Public Shared Function MyODBCDataset(ByVal ReqSQL As String, _
         ByVal LaBase As String, ByVal Server As String, _
         ByVal Password As String, ByVal User As String, _
         ByVal NomDataSet As String) As DataSet
    ' Connexion à un server MySQL 

    'avec le Driver ODBC 3.51 avec requette qui renvoie un dataset

    Dim MyConString As String = _
        "DRIVER={MySQL ODBC 3.51 Driver};SERVER=" & Server _
        & ";DATABASE=" & LaBase & ";UID=" & User _
        & ";PASSWORD=" & Password & ";OPTION=3;"

    Dim MyODBCConnexion As New OdbcConnection(MyConString)
    Try
        Dim ds As New DataSet()
        Dim cmd As OdbcDataAdapter = New 
        OdbcDataAdapter(ReqSQL, MyConString)
        Dim MyCommand As New OdbcCommand()
        Dim MyDataReader As OdbcDataReader
        cmd.Fill(ds, NomDataSet)
        MyODBCConnexion.Close()
        Return ds
    Catch MyOdbcException As OdbcException
    ' 

      HttpContext.Current.Response.Write(MyOdbcException.ToString)
    Catch MyException As Exception
    ' 

      HttpContext.Current.Response.Write(MyException.ToString)
    End Try
End Function

The call of this function may be like that:

Dim MonDatasetTemp As DataSet = MySQL_Requettes.MyODBCDataset(
               SQL,
               constantes.ODBCBase, 
               constantes.ODBCServer, 
               constantes.ODBCPwd, 
               constantes.ODBCUser, 
               "MonDataset")

Conclusion

This library is the first example I made for the MySQL use in my ASP.NET solutions. I hope it can be easy for use in your projects.

You can also see the French version of this article more directed for the creation and use of the class library :

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Romelard Fabrice (Alias F___)


I'm French Web developer and MVP.
My favorites languages are ASP.NET and SharePoint. I made a lot of projects in open source and many articles.
You can see all my articles on french developer sites like :
- http:/:www.asp-php.net
- http://www.aspfr.com

My technical blog is in French community :
- http://blogs.developpeur.org/fabrice69/

Romelard Fabrice [MVP]

Occupation: Web Developer
Location: Switzerland Switzerland

Other popular Database articles:

Article Top
Sign Up to vote for this article
You must Sign In to use this message board.
FAQ FAQ Noise ToleranceSearch Search Messages 
 Layout  Per page   
 Msgs 1 to 14 of 14 (Total in Forum: 14) (Refresh)FirstPrevNext
GeneralThe trust relationship between this workstation and the primary domain failed.memberMind Experts13:59 27 Jun '06  
Generalerror 403 !!!memberLil`Buh2:23 16 Feb '04  
GeneralNot Support AuthendicationsussAnonymous23:12 18 Jan '04  
GeneralRe: Not Support AuthendicationmemberNazz22:59 25 Nov '08  
Generalnice worksussAnonymous5:28 16 Jan '04  
GeneralWhat?memberdog_spawn6:02 18 Jul '03  
GeneralRe: What?memberJuergen Posny6:05 18 Jul '03  
Generaler okmemberdog_spawn6:15 18 Jul '03  
GeneralRe: er okmemberRomelard Fabrice (Alias F___)6:44 18 Jul '03  
GeneralAh, pilote = drivermemberdog_spawn6:59 18 Jul '03  
GeneralRe: Ah, pilote = driversussNix_11:19 24 Aug '03  
GeneralAlready saidmemberdog_spawn11:41 24 Aug '03  
GeneralRe: Already saidsussNix_10:43 30 Aug '03  
Generalhow ?memberdenise83840517:12 29 Aug '04  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 17 Jul 2003
Editor: Smitha Vijayan
Copyright 2003 by Romelard Fabrice (Alias F___)
Everything else Copyright © CodeProject, 1999-2008
Web15 | Advertise on the Code Project