Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 a class library project,I use SP to replace D-sql

Author  Topic 

debradeng
Starting Member

46 Posts

Posted - 2006-11-01 : 19:45:57
I did the followiing change:

[System.Diagnostics.DebuggerNonUserCodeAttribute()]
private void InitCommandCollection() {
this._commandCollection = new System.Data.SqlClient.SqlCommand[1];
this._commandCollection[0] = new System.Data.SqlClient.SqlCommand();
this._commandCollection[0].Connection = this.Connection;
this._commandCollection[0].CommandText = "Proc... ... "; //Add // this._commandCollection[0].CommandText = @""; //Delete

this._commandCollection[0].CommandType = System.Data.CommandType.Text;
this._commandCollection[0].Parameters.Add(new System.Data.SqlClient.SqlParameter("@Param1", System.Data.SqlDbType.BigInt, 8, System.Data.ParameterDirection.Input, 0, 0, "AccountId", System.Data.DataRowVersion.Current, false, null, "", "", ""));
}

I guess the changes I made should be fine,but How can I make sure it works?Since the project is not executable.

Any advice?

snSQL
Master Smack Fu Yak Hacker

1837 Posts

Posted - 2006-11-02 : 18:33:36
Is this part of an application or are you trying to create a CLR procedure in SQL Server 2005? It looks like it's in an application in which case you should rather post in one of the Development Tools forums.

Just looking at your code, you'll need to change the CommandType to stored procedure. The create an application (web, Windows, or console) and reference this class library so that you can test it.
Go to Top of Page

debradeng
Starting Member

46 Posts

Posted - 2006-11-02 : 20:57:44
Thank you,snSQL.I used Visual Studio 2005 as tools and I have no idea on "create an application and reference the class library to test it"!

You are right,I only changed command text,I should also change command type.

Do I need to change Parameters.add(...)?

For my first question,I will post in other forums. Thank you again!
Go to Top of Page

snSQL
Master Smack Fu Yak Hacker

1837 Posts

Posted - 2006-11-03 : 01:05:50
In the documentation find out how to create web or Windows or console application and add a reference. Those are the two most fundamental things you need to learn how to do in Visual Studio 2005, if you can't do that yet then you are wasting your time trying to edit code.
Go to Top of Page

debradeng
Starting Member

46 Posts

Posted - 2006-11-03 : 01:13:57
Thank you for your advice,but don't be so harsh.I know how to create a console application at least, and I already referrenced the class library into it,but...

I will try to figure it out by myself,I know it is the basic for a developper:)
Go to Top of Page

snSQL
Master Smack Fu Yak Hacker

1837 Posts

Posted - 2006-11-03 : 02:55:19
I wasn't being harsh, if I was being harsh, I would have said you were wasting my time

I was just trying to point out that you are wasting your own time focussing on fixing that code if you cannot run it. So you need to create an application that can run the code first, then you will be able to work on that code - it sounds like you have managed to do that, so you're getting somewhere.

I don't know if you have a problem with the parameter, you'll need to post your stored procedure code so that I can see if the stored procedure has any parameters.
Go to Top of Page
   

- Advertisement -