AllExperts > Delphi 
Search      
Delphi
Volunteer
Answers to thousands of questions
 Home · More Delphi Questions · Answer Library  · Encyclopedia ·
More Delphi Answers
Question Library

Ask a question about Delphi
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Randy Sill
Expertise
Turbo Pascal and Delphi developer since 1986. Strengths - UI, Windows API, Database, SQL, Internet, Threading, NT Services.

Experience
Turbo Pascal and Delphi developer since 1986.

Education/Credentials
Delphi 5 Certification, Borland

Awards and Honors
2005 Indiana IT/Software Million Dollar Award, Key Technical Contributor

 
   

You are here:  Experts > Computing/Technology > Delphi Programming > Delphi > Trouble making ODBC connection

Delphi - Trouble making ODBC connection


Expert: Randy Sill - 10/15/2009

Question
QUESTION: Hello,

I am developing application using C++Builder. I use the TQuery object to execute queries to a local SQL Server 2000.

Recently I executed an SQL statement (which always succeeded before today) and I got error message like this:

Invalid parameter .

There is a dot in the error message. The SQL statement has no parameter or dot character.

Then I tried to make a new ODBC connection to the local SQL Server. On the first step, there is a server drop down list. And there is a dot listed in the drop down list. The computer name is not listed.

But strange, when I connect the computer to LAN, the computer name and (local) appears in the server drop down list.

What do you think is the problem?

Thank you,
Frans Indroyono

ANSWER: The single Dot often means "This PC".  If I were to have a SQL server instance, I could use ".\InstName" as the server name just as easily as "MyPCName\InstName".  If you are using the default SQL setup without instance then Server can be just "." and your connection will work fine.  I often do that in a multi developer environment so that we're all pointing to our local system for database.  Invalid parameter can mean a lot of things, so not sure what the cause of that error is.  Have you tried the same command in Enterprise Manager query window?

---------- FOLLOW-UP ----------

QUESTION: Hello,

Somehow, the '.' problem solved after I removed a connection name from BDE. I think I have made two connections in ODBC dan BDE with the same name. So, I think that was the cause of the problem.

This morning, I got the same problem. This time there is no connection name duplication. I think I have to clear up the situation:

I am using one ODBC connection to SQL Server.
I have two modules using TQuery to connect a database using that ODBC connection.
One module goes very well.
The other module crash with error message: 'Invalid parameter .' there is a '.'

The query on the second module is fine. I tried it on Enterprise Manager or Query analyzer.

The thing that confuses me is: one connection, two TQueries. One TQuery succeeded, the other TQuery failed. Why?

I am using a querying module so the implementation (initialisation, executing query, getting query result, etc) on both TQuery are the same.

Any idea?

Thanks,
Frans

Answer
I've avoided the BDE since there is an additional installation, configuration, and performance reduction.  I use SDAC (SQL Data Access Components) and connect hundreds of queries to a single DB Connection with no trouble at all.  I'm not sure what would be the issue with this Query.

Add to this Answer   Ask a Question


 
User Agreement | Privacy Policy | Kids' Privacy Policy | Help
Copyright  © 2008 About, Inc. AllExperts, AllExperts.com, and About.com are registered trademarks of About, Inc. All rights reserved.