Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2004
    Posts
    110

    Unanswered: ADO.Net connection string

    In an application using good old ADO I used the connection string :

    Code:
    DRIVER={MySQL ODBC 3.51 Driver}; " & "SERVER = " & strServerIP & "; " & " DATABASE=bio_tech; " & "UID = " & strOnomaXrhsth & "; PWD = " & strKwdikosXrhsth & ";
    Can this same connection string be used as a Parameter to the DataAdapter class of ADO.NET? Do I need to make some changes to get the same connection under ADO.NET?
    Last edited by divined; 07-06-06 at 06:34.

  2. #2
    Join Date
    Jul 2006
    Posts
    26
    are you using asp.net? or just ado.net? If it is just ado.net, I think it will work fine the way it is. If it is asp.net i would recomend installing the .net connector for mysql

  3. #3
    Join Date
    Apr 2004
    Posts
    110
    ok. I installed the net Connector driver.

    Now I want to connect through a DataAdapter class using Visual C# 2005. What is the connection string I need to use?

  4. #4
    Join Date
    Jul 2006
    Posts
    26
    this is the one i used
    server=localhost; user id=username; password=password; database=dbname; pooling=false;

    a few snippits from a page (its vb)
    Code:
    <%@ Page Language="VB" ContentType="text/html" ResponseEncoding="iso-8859-1" %>
    <% @Import Namespace="System.Data" %>
    <% @Import Namespace="MySQL.Data.MySQLClient" %>
    
    <script runat="server">
    	Dim strCon As MySQLConnection = New MySqlConnection("connString")
    	sub bindUData()
    		dim strSQL as string = "select * from table"
    		Dim objCommand as New MySQLCommand(strSQL, strCon)
    		strCon.open()
    
    		Dim myAdapter as New MysqlDataAdapter(objCommand)
    		Dim ds as New DataSet()
    		myAdapter.Fill(ds)
        		
    		dgUsers.DataSource = ds
    		dgUsers.DataBind()	
    		
    		strCon.close()
    	end sub
    that should be able to get you going

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •