BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Re: How to access Store Procedures from Delphi 8 Architect

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (SQL Servers)
View previous topic :: View next topic  
Author Message
Milan Lamichhane
Guest





PostPosted: Tue Aug 03, 2004 8:38 am    Post subject: Re: How to access Store Procedures from Delphi 8 Architect Reply with quote




Try this. Pls remember, this code is not tested yet. It will give you
rough idea how to use sproc. in Delphi 8.


procedure TSomeObject.AddUser(UserName,Email: String);
var
objConn : SqlConnection;
objComm : SqlCommand;
paramUserName, paramEmail : SqlParameter;
begin

//replace getConnectionString with your connection string
objConn := SqlConnection.Create(getConnectionString);
objConn.Open;

objComm := SqlCommand.Create('Stored_Proc_Name',objConn);
objComm.CommandType := CommandType.StoredProcedure;

paramUserName:=
SqlParameter.Create('@pUsername',SqlDBType.VarChar,100);
paramUserName.Value := TObject(UserName);
objComm.Parameters.Add(paramUserName);

paramEmail := SqlParameter.Create('@pEmail',SqlDBType.VarChar,100);
paramEmail.Value := TObject(Email);
objComm.Parameters.Add(paramEmail);

Result := objComm.ExecuteNonQuery;
end;



mILAN

Oliver Reitemeier wrote:

Quote:
Hi,

i am a Newbie and need help.
I have a Stored Proc on my MS Sql 2000 Server.
The Store Proc should insert a User into a User Database. The Parameters are
pUsername and pEmail.

What i have to to use this Store Proc from my Delphi 8 Architect Version
where i have an ASP .Net Site.

Thanks a lot!!!!!!
Oliver



Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (SQL Servers) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.