Board index » delphi » SQLDataset with MS SQL Stored Procs
Emmanuel Fayet
Delphi Developer |
SQLDataset with MS SQL Stored Procs2003-10-22 11:29:50 PM delphi212 Hi, I have a MS SQL 2000 stored proc returning a list of customers. I can successfully call from Delphi 7 the stored proc using the following code : //-- properties set at design-time //-- SqlDataSet.CommandText:= 'dbo.listcustomer'; //-- SqlDataSet.CommandType:= ctStoredProc; SqlDataSet.Open; while not SqlDataSet.eof do begin SqlDataSet.Next; end; SqlDataSet.Close; But I have a SQL error when I try to call a stored proc requiring a input parameter. //-- properties set at design-time //-- SqlDataSet.CommandText:= 'dbo.getcustomer'; //-- SqlDataSet.CommandType:= ctStoredProc; SqlDataSet.ParamByName('CustomerID').AsString:= 'VINET'; SqlDataSet.Open; if not SqlDataSet.eof then begin end; SqlDataSet.Close; with : CREATE PROC dbo.getcustomer ( @CustomerID NCHAR(5) ) AS BEGIN SELECT CustomerID, CompanyName, ContactName, ContactTitle, Address, City, Region, PostalCode, Country, Phone, Fax FROM Customers WHERE CustomerID = @CustomerID RETURN END Thank you for your help. Emmanuel Fayet |