Click here to Skip to main content
15,895,606 members
Home / Discussions / C#
   

C#

 
GeneralRe: A question of a Game Pin
CWIZO2-Apr-04 2:42
CWIZO2-Apr-04 2:42 
GeneralRe: A question of a Game Pin
lajiyo2-Apr-04 23:01
lajiyo2-Apr-04 23:01 
GeneraldataSet, combobox Pin
DougW481-Apr-04 14:53
DougW481-Apr-04 14:53 
GeneralRe: dataSet, combobox Pin
Anonymous1-Apr-04 16:47
Anonymous1-Apr-04 16:47 
GeneralC# Whidbey Language Changes Pin
Eric Gunnerson (msft)1-Apr-04 13:57
Eric Gunnerson (msft)1-Apr-04 13:57 
GeneralRe: C# Whidbey Language Changes Pin
CWIZO2-Apr-04 2:46
CWIZO2-Apr-04 2:46 
Generalstruct conversion(VB->C#) problem Pin
Member 6548331-Apr-04 13:21
Member 6548331-Apr-04 13:21 
GeneralC# . Question on "Microsoft Data Access Application Block" Pin
abidkayani11-Apr-04 12:30
abidkayani11-Apr-04 12:30 
Hi,

SQLHelpder class is given in "Data Access Application Block". This block sample code is availabe on
Microsoft MSDN. Why am I using this becuase of time saving. Useful overloads are available to do more in less time.

What I need in a form is the newly added IDs in a table. For example I wrote the following code


//This module will insert a new role in the tblRole table by calling the stored procedure uspRoleNew

SqlParameter[] arparam = new SqlParameter[9];

arparam[0] = new SqlParameter("@pRoleName",SqlDbType.VarChar, 50);
arparam[0].Value= mRoleName;
arparam[1] = new SqlParameter("@pRoleDesc", SqlDbType.VarChar,50);
arparam[1].Value= mRoleDescription;
.
.
. .
arparam[8] = new SqlParameter("@pRoleIDout", SqlDbType.Int);
arparam[8].Direction=ParameterDirection.Output;

SqlHelper.ExecuteNonQuery(clsGeneral.conStr, "uspRoleNew", arparam);

int _RoleID;
_RoleID = (int)arparam[8].Value;

In paramerter[8] i want the newly added ID. But SqlHelper is not returning any value.


Below is the alternative solution for the above problem

mSqlCommand.Connection= _Sqlconn;
mSqlCommand.CommandText="uspRoleNew";
mSqlCommand.CommandType=CommandType.StoredProcedure;

mSqlCommand.Parameters.Add("@pRoleName",SqlDbType.VarChar, 50);
mSqlCommand.Parameters[0].Value=mRoleName;

mSqlCommand.Parameters.Add("@pRoleDesc", SqlDbType.VarChar,50);
mSqlCommand.Parameters[1].Value= mRoleDescription;

mSqlCommand.Parameters.Add("@pRoleIDout", SqlDbType.Int);
mSqlCommand.Parameters["@pRoleIDout"].Direction= ParameterDirection.Output;

_Sqlconn.Open();
mSqlCommand.ExecuteNonQuery();

mRoleID = (int)mSqlCommand.Parameters["@pRoleIDout"].Value;
return mRoleID;

QUESTION ????? is Why sqlhelper not doing this. If u r aware of "Data Access Application Block" plz reply.

GeneralC# problem .. SQLParameters Pin
abidkayani11-Apr-04 12:25
abidkayani11-Apr-04 12:25 
GeneralRe: C# problem .. SQLParameters Pin
Charlie Williams1-Apr-04 13:25
Charlie Williams1-Apr-04 13:25 
GeneralChild windows opening outside the screen! Pin
Carl Mercier1-Apr-04 12:04
Carl Mercier1-Apr-04 12:04 
GeneralRe: Child windows opening outside the screen! Pin
Dave Kreskowiak1-Apr-04 13:10
mveDave Kreskowiak1-Apr-04 13:10 
GeneralRe: Child windows opening outside the screen! Pin
Carl Mercier1-Apr-04 17:03
Carl Mercier1-Apr-04 17:03 
GeneralRe: Child windows opening outside the screen! Pin
Dave Kreskowiak2-Apr-04 4:56
mveDave Kreskowiak2-Apr-04 4:56 
GeneralRe: Child windows opening outside the screen! Pin
Carl Mercier2-Apr-04 6:12
Carl Mercier2-Apr-04 6:12 
GeneralRe: Child windows opening outside the screen! Pin
Dave Kreskowiak2-Apr-04 6:22
mveDave Kreskowiak2-Apr-04 6:22 
GeneralRe: Child windows opening outside the screen! Pin
Carl Mercier2-Apr-04 6:35
Carl Mercier2-Apr-04 6:35 
GeneralProblem with web browser control in Windows Form Pin
Tim Kohler1-Apr-04 11:23
Tim Kohler1-Apr-04 11:23 
GeneralComboBox on a ToolBar Menu Pin
adam.southerland@oscn.net1-Apr-04 11:22
adam.southerland@oscn.net1-Apr-04 11:22 
Generalproblem with the project reference Pin
dizzyha1-Apr-04 10:35
dizzyha1-Apr-04 10:35 
GeneralRe: problem with the project reference Pin
Heath Stewart1-Apr-04 10:40
protectorHeath Stewart1-Apr-04 10:40 
GeneralCreateGraphics Problem Pin
Tristan Rhodes1-Apr-04 10:25
Tristan Rhodes1-Apr-04 10:25 
GeneralRe: CreateGraphics Problem Pin
Heath Stewart1-Apr-04 10:39
protectorHeath Stewart1-Apr-04 10:39 
GeneralRe: CreateGraphics Problem Pin
Tristan Rhodes1-Apr-04 10:50
Tristan Rhodes1-Apr-04 10:50 
GeneralRe: CreateGraphics Problem Pin
Heath Stewart2-Apr-04 8:58
protectorHeath Stewart2-Apr-04 8:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.