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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DCC Error - incompatible types 'Array' and 'String'

Status
Not open for further replies.

smitty654

Programmer
Jul 9, 2008
21
CA
I am presently trying out the MyDac Demo component for MySQL, using Delphi 2007 for Win32. I am told it has similar functionality to the ADO components. However, I am having problems inserting records into a table with it. Here is what I used to insert the record:
Code:
  MyTable1.InsertRecord(StudentLastName + StudentFirstName + ParentFullName +
    StudentBirthDate + StudentAge +  StudentPhoneHome + StudentPhoneCell +
    StudentPhoneWork + StudentAddress + StudentCity + StudentState +
    StudentZipCode + StudentSignupDate + StudentSignupTime + StudentStartDate +
    StudentStartTime)
MyTable1 is supposed to be similar to AdoTable1 with the ADO components. When I execute this code, I get the same error message indicated in the subject title for this post. I tried putting ',' instead of the '+' signs and I still get the same error message. I am using Edit Boxes for the end-user to type in, which will later 'submit' all this information using a (you guessed) 'Submit' button, which inserts the the record into the table. I tried using DBEdit fields, but it won't allow me to enter data with it. I also tried googling the topic, with not much success. Thanks for your time.
P.S. Please note that I am taking tutorial code snippets from ' in my application. It states that this is the easiest method to insert records. If anyone has any additional insights on this, please 'Submit'! ;)
 
It's quite possible that one or more of the parts that you are trying to put together are array components and not strings.

Look in your references you posted on typecasting and data types, specifically on the parts that discuss "PChar".

----------
Measurement is not management.
 
Right. I found out if I enclosed inside tne whole InsertRecord() with braces, it worked. Apparently, it was looking at the whole function as an array(of string data type, in this case). Thanks for the additional insight, though. I found the answer prior through a google search for constant arrays, which guided me back to my posted tutorial website. I also found "The Developer's Guide to Delphi Troubleshooting" a bit helpful.
 
It states that this is the easiest method to insert records

I would have to disagree....the easiest method is going to be the SQL INSERT statement....
Code:
INSERT INTO TABLENAME (Field1, Field2) VALUES (Value1, Value2)



Leslie

Have you met Hardy Heron?
 
I could probably agree the more experience I have with database programming. I've read online somewhere that SQL statements are used mainly for reporting purposes. Does this imply that other methods 'should' be used for non reporting purposes? Thanks for the reply! ;)
 
lespaul said:
I would have to disagree....the easiest method is going to be the SQL INSERT statement....

+1

smitty654 said:
I've read online somewhere that SQL statements are used mainly for reporting purposes.

SQL is all things to all people when it comes to relational databases.

----------
Measurement is not management.
 
you can use SQL to change data:

Code:
UPDATE TableName SET FieldName = 'SomeValue';
DELETE FROM table1 WHERE column1 = 0;

you can use it to change the table:
Code:
ALTER TABLE table1 DROP COLUMN column3;
ALTER TABLE table1 ALTER COLUMN column1 SET DATA TYPE char(100);
ALTER TABLE table1 ADD CONSTRAINT constraint1 PRIMARY KEY (column1);

It's extremely powerful!!
{disclaimer - above statement syntax is probably wrong for access!! but you get the idea!!}

Leslie

Have you met Hardy Heron?
 
I've read online somewhere that SQL statements are used mainly for reporting purposes.
Proving that everything you read on the Web was written by an expert whose credibility is beyond reproach.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top