3 Replies - 2708 Views - Last Post: 05 March 2005 - 08:02 AM Rate Topic: -----

#1 vitalstates  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 04-March 05

Sql Reply From Adodataset Command

Posted 04 March 2005 - 08:26 AM

Hi
can anybody tell me how to access the sql reply from an adodataset when there is no reply set. I am passing the sql string to adodataset which is attached to a datasource and in turn to a dbgrid. This is fine if the sql returns a reply set but if the reply is a record count from an insert or update for example, then how can I get this reply.

Thanks

V
Is This A Good Question/Topic? 0
  • +

Replies To: Sql Reply From Adodataset Command

#2 born2c0de  Icon User is offline

  • printf("I'm a %XR",195936478);
  • member icon

Reputation: 180
  • View blog
  • Posts: 4,667
  • Joined: 26-November 04

Re: Sql Reply From Adodataset Command

Posted 05 March 2005 - 02:07 AM

Dim sql As String
  'define SQL query
  sql = Text1.Text
  'specify format of SQL result and assisgn to ADODC
  Adodc1.CommandType = adCmdText
  Adodc1.RecordSource = sql
  Adodc1.Refresh
  DataGrid1.Refresh
  'Display result in the datagrid object
  Set DataGrid1.DataSource = Adodc1



See if this helps...I written many in VB...if the code doesnt help...let me know...I'll attach the full form then...
Was This Post Helpful? 0
  • +
  • -

#3 vitalstates  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 04-March 05

Re: Sql Reply From Adodataset Command

Posted 05 March 2005 - 06:49 AM

many thanks for the reply born2code

The code you posted is much the same as I have and it works fine when the query returns a result set. But when the jet system just wants to return a message such as '10 records updated' from a DDL command I cant access it. It is these messages I want to get hold of.

[try
lc_dm1.lc_adodset1.active := false;
lc_dm1.lc_adodset1.commandtext := memo1.text;
lc_dm1.lc_adodset1.active := true;
edit1.Text := inttostr(lc_dm1.lc_adodset1.RecordCount);

except
messagedlg('Invalid SQL statement!',mterror,[mbok],0);
end;]

thanks

V
Was This Post Helpful? 0
  • +
  • -

#4 born2c0de  Icon User is offline

  • printf("I'm a %XR",195936478);
  • member icon

Reputation: 180
  • View blog
  • Posts: 4,667
  • Joined: 26-November 04

Re: Sql Reply From Adodataset Command

Posted 05 March 2005 - 08:02 AM

Hmm...Never tried finding out such things...I'll test some code..and then get back to you...
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1