Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2004
    Posts
    2

    Unanswered: Converting from Mysql to SQL server

    hi.. currently i need to convert from mysql to sql
    how am i to convert it ? below are my previous codes
    thanks!

    Imports System.Configuration.ConfigurationSettings
    Imports System.Web.HttpContext
    Imports System.Data.Odbc


    Public Class DB
    Dim myDB As New OdbcConnection
    Dim myCMD As New OdbcCommand
    Public Sub New()
    Dim db_server = AppSettings("db_server")
    Dim db = AppSettings("db")
    Dim db_user = AppSettings("db_user")
    Dim db_pwd = AppSettings("db_pwd")
    Dim DBConnection As String = "DRIVER={MySQL ODBC 3.51 Driver};" & _
    "SERVER=" & db_server & ";" & _
    "DATABASE=" & db & ";" & _
    "UID=" & db_user & ";" & _
    "PASSWORD=" & db_pwd & ";" & _
    "OPTION=3;"
    myDB.ConnectionString = DBConnection
    myCMD.Connection = myDB
    End Sub

    Public Function q(ByVal mySTR As String) As OdbcDataReader
    myCMD.CommandText = mySTR
    Try
    myDB.Open()
    q = myCMD.ExecuteReader(Data.CommandBehavior.CloseConn ection)
    Catch ex As Exception
    Err(ex.ToString)
    End Try

    End Function

    Public Sub c(ByVal mySTR As String)
    Try
    myCMD.Connection.Open()
    myCMD.CommandText = mySTR
    myCMD.ExecuteNonQuery()
    myCMD.Connection.Close()
    Catch ex As Exception
    Err(ex.ToString)
    End Try

    End Sub


    Private Sub Err(ByVal strError As String)
    Current.Response.Write("<h1>An error has occurred.</h1><br>" & vbCrLf)
    Current.Response.Write("Please report to us the error message<br>" & vbCrLf)
    Current.Response.Write(strError)
    Current.Response.Flush()
    Current.Response.End()
    End Sub
    End Class

  2. #2
    Join Date
    Aug 2002
    Location
    Scotland
    Posts
    1,578
    I don't know about MySQL but this code looks like VBA code.
    --Satya SKJ
    Microsoft SQL Server MVP
    [IMG]http://sqlserver-qa.net/google_bart.gif[/IMG]

Posting Permissions

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