Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TurboDelphi MySQL Connectivity problem

Status
Not open for further replies.

wizzor

Programmer
Aug 29, 2006
23
FI
Hi,
I've been asking about databases before, and 'til now, had to use BDE for my database connectivity. I'm currently using TurboDelphi for development.

I wanted to use dbExpress to connect to a mysql database to do some simple database editing, but what do you know, it doesn't work :(

Here's what I did:
TSQLConnection to connect to the database. To my amazement, it seems to work.
TSQLDataSet for querying.
TDataSetProvider and
TClientDataSet as well as
TDataSource for handling the data.

Simple, or so I thought.

Code:
object SQLConnection1: TSQLConnection
    ConnectionName = 'MySQLConnection'
    DriverName = 'MySQL'
    GetDriverFunc = 'getSQLDriverMYSQL'
    LibraryName = 'dbxmys30.dll'
    [b]LoginPrompt = False[/b]
    Params.Strings = (
      'BlobSize=-1'
      'Database=*****'
      'DriverName=MySQL'
      'ErrorResourceFile='
      'HostName=localhost'
      'LocaleCode=0000'
      'Password=*****'
      'User_Name=*****'
      'Compressed=False'
      'Encrypted=False')
    VendorLib = 'LIBMYSQL.dll'
    [b]Connected = True//This is what makes me think it works[/b]
    Left = 72
    Top = 40
  end
  object SQLDataSet1: TSQLDataSet
    SchemaName = '*****'
    [b]CommandText = 'contact'[/b]
    [b]CommandType = ctTable[/b]
    MaxBlobSize = -1
    Params = <>
    [b]SQLConnection = SQLConnection1[/b]
    Left = 72
    Top = 72
  end
  object DataSetProvider1: TDataSetProvider
    [b]DataSet = SQLDataSet1[/b]
    Left = 72
    Top = 104
  end
  object ClientDataSet1: TClientDataSet
    Aggregates = <>
    Params = <>
    [b]ProviderName = 'DataSetProvider1'[/b]
    Left = 72
    Top = 136
  end
  object DataSource1: TDataSource
    [b]DataSet = ClientDataSet1[/b]
    Left = 72
    Top = 168
  end
end

I tried this using ctTable as well as ctQuery, and all I got was errors.
With ctTable, I got "Invalid field type"
With ctQuery (using select * from contact;) as the CommandText value. I got the same error.

Can anyone point me to the right direction?
I have XAMPP running with MySQL service for database connectivity.

Oh yeah, by the way. I'm slightly new to this. Have mercy:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top