A
Andrea Raimondi
D'oh!
I'm feeling this is related to ADO.NET and maybe you can help here.
Please, don't hide behind "Microsofties don't know pascal" because
this is a very framework issue rather than Delphi.
This is the code:
procedure TFaqService.AddItem(Q,A : String);
var OleDBParam : OleDBParameter;
begin
OleDBParam := OleDBParameter.Create('QuestionText',OleDbType.VarWChar,
255, Q);
InsertFAQ.Parameters.Add(OleDBParam);
OleDBParam := OleDBParameter.Create('AnswerText',OleDbType.VarWChar,
255, A);
InsertFAQ.Parameters.Add(OleDBParam);
ADOConn.Open;
InsertFAQ.ExecuteNonQuery;
ADOConn.Close;
end;
For your facility(even though I beleive not strictly necessary), some
explainations:
ADOConn -> OLEDBConnection
InsertFAQ -> OLEDBCommand
Other data:
Database schema(1 table, Access):
TABLE FAQS
ID_Question Autoincrement
QuestionText Text 255
AnswerText Text 255
Query:
Insert Into Faqs(QuestionText,AnswerText)
values(QuestionText=?,AnswerText=?)
This is the relevant code into "InitializeComponents":
(self is referred to the webservice class)
Self.ADOConn := System.Data.OleDb.OleDbConnection.Create;
Self.InsertFAQ := System.Data.OleDb.OleDbCommand.Create;
Self.InsertFAQ.CommandText := 'Insert Into Faqs(QuestionText,
'AnswerText) values(QuestionText=?,'+
'AnswerText=?)';
Self.InsertFAQ.Connection := Self.ADOConn;
Can you see anything wrong? Anything I didn't set that should
instead be?
Cheers,
Andrew
I'm feeling this is related to ADO.NET and maybe you can help here.
Please, don't hide behind "Microsofties don't know pascal" because
this is a very framework issue rather than Delphi.
This is the code:
procedure TFaqService.AddItem(Q,A : String);
var OleDBParam : OleDBParameter;
begin
OleDBParam := OleDBParameter.Create('QuestionText',OleDbType.VarWChar,
255, Q);
InsertFAQ.Parameters.Add(OleDBParam);
OleDBParam := OleDBParameter.Create('AnswerText',OleDbType.VarWChar,
255, A);
InsertFAQ.Parameters.Add(OleDBParam);
ADOConn.Open;
InsertFAQ.ExecuteNonQuery;
ADOConn.Close;
end;
For your facility(even though I beleive not strictly necessary), some
explainations:
ADOConn -> OLEDBConnection
InsertFAQ -> OLEDBCommand
Other data:
Database schema(1 table, Access):
TABLE FAQS
ID_Question Autoincrement
QuestionText Text 255
AnswerText Text 255
Query:
Insert Into Faqs(QuestionText,AnswerText)
values(QuestionText=?,AnswerText=?)
This is the relevant code into "InitializeComponents":
(self is referred to the webservice class)
Self.ADOConn := System.Data.OleDb.OleDbConnection.Create;
Self.InsertFAQ := System.Data.OleDb.OleDbCommand.Create;
Self.InsertFAQ.CommandText := 'Insert Into Faqs(QuestionText,
'AnswerText) values(QuestionText=?,'+
'AnswerText=?)';
Self.InsertFAQ.Connection := Self.ADOConn;
Can you see anything wrong? Anything I didn't set that should
instead be?
Cheers,
Andrew