Showing posts with label value. Show all posts
Showing posts with label value. Show all posts

Friday, March 30, 2012

How to get type of parameter passed in stored procedure?

Hi ,

I wrote a stored procedure with one uinqueidentifier parameter.Depending upon the value passed during execution type of parameter passed is changing.

Example:

CREATE PROCEDURE ABC_Proc

@.ABC uniqueidentifier = NULL

Execution:

EXEc ABC_Proc ' '

If I pass the uiqueidentifier from the same table then the program executes properly.If same uinqueidentifier from other table or NULL or '' is passed the following error is displayed

"conversion failed when converting from a character string to unique identifier."

Questions:IS there a way to get the datatype of parameter passed in the querry?so, that I can modify accordingly.

Thanks,

Kodela.

Hi Kodela,

The easiest way is to use the new sql_variant datatype as the parameter, and then within the procedure, you can test for the base datatype and execute the appropriate action:

declare @.v sql_variant

set @.v = 123

if SQL_VARIANT_PROPERTY ( @.v , 'BaseType' ) = 'int'
begin
print 'int type passed'
end
else if SQL_VARIANT_PROPERTY ( @.v ,'BaseType' ) = 'uniqueidentifier'
begin
print 'uid type passed'
end

Cheers,
Rob

|||

You could use sql_variant, but the best thing to do is to treat parameters as strongly typed and only pass proper values to that parameter. You can get the type of the parameter from the information_schema:

CREATE PROCEDURE ABC_Proc
@.ABC uniqueidentifier = NULL
as
select @.ABC
go

select parameter_name, data_type
from information_schema.parameters
where specific_name = 'ABC_Proc'
and specific_schema = 'dbo'

|||

Robert Varga wrote:

use the new sql_variant datatype

Robert,

There is a reason that the variant datatype has been removed from Visual Studio.Net -it opens the code to potential attack vectors. Similarly, it is not a particularly good thing to use in SQL Server. Often the use of variants demonstrates a poor design, or just plain sloppy coding. -NOT drawing aspersions to you or your techniques, just commenting...

Regards,

|||

Hi Arnie,

I have to say I disagree completely. The SQL_VARIANT datatype was introduced in SQL 2005 for good reason. Just as there are valid reasons for using cursors, there are valid reasons for using the sql_variant datatype, and blanket statements alluding to their use constituting "poor design" are flawed.

In reality, we've been using varchar's as "variant" datatypes for years - ( CONVERT(varchar(15), GETDATE(), 103) anyone? ) and the new datatype removes precision related errors.

Cheeers,
Rob

|||

I actually have to agree that the SQL_VARIANT datatype should generally be avoided (as should converting dates to varchar values too, since that is usually a formatting gimmick that we *should* let the presentation layer handle :) for the same reason that VB programmers shouldn't generally use Option Strict (I think that was (is?) the syntax).

Especially in this situation, picking the proper datatype is part of the contract between caller and callee. In your example, it would not be possible to tell a GUID from a character value, certainly not when being passed in as a parameter, since it would be passed as a string of characters (or as a binary value) which could not be distinguished in code.

It is not completely useless when used for sparse property tables where you define the metadata of the column at runtime is a pretty good use, but generally having a column of unknown type means more code, more work, and greater chance for errors later.

|||

Hi Louis,

Sure; just as liberal use of, say, cursors is not a good thing, neither is the use of generic datatypes. My point is that there are circumstances in which the use of sql_variant (or cursors) are valid and should not be discounted by zealots simply because some Wrox book said they were "bad".

Cheers,
Rob

|||

Louis,

You demonstrate my point precisely. There is no need to use a sql_variant in this situation. The metadata is available. Strongly typed variables/parameters reduce coding and coding errors.

Using an object datatype (the .NET replacement for 'variant' has it's place and needs, and slq_variant has it's places and usages. However, in my opinion, it should not be used in a situation where the exact need does not exist. This is not one of those situations.

And gosh, if one wanted to morph a varchar() parameter, the datatype could be just another input parameter. For me, strongly typing is the key. If the dataype is known when the call is made, it should be strongly typed.

How to get Time in SmallDateTime?

Hi,
I just want to get the value from a smalldatetime into time only in a SQL Statement
10/10/2005 10:00:00 AM -- > 10:00:00 AM
What would be the best approached?
Thanks,
VinceThis will truncate all datetime values to Jan 1, 1900, leaving only the time portion. To format the resulting value, look up the CAST and CONVERT functions.
declare @.MyTime smalldatetime
set @.MyTime = getdate()
select dateadd(d, -datediff(d, 0, @.MyTime), @.MyTime)

How to get the windows current user currently logged from SQL Server

Hi I am using exec master..xp_cmdshell "ECHO %USERNAME%" to get the windows
user name currently logged in. But it gives me the NULL value. I even tried
exec master..xp_cmdshell "ECHO SET %USERNAME%" but it doesnt help me.
Does any body have idea how to get the windows user name who is currently lo
gged from SQL Server.
Thanks for you help.
HemanthTry suser_sname()
Ray Higdon MCSE, MCDBA, CCNA
--
"Hemanth" <kamishetty@.hotmail.com> wrote in message
news:8843EE8B-D217-4DA1-A47F-D7D19804C819@.microsoft.com...
> Hi I am using exec master..xp_cmdshell "ECHO %USERNAME%" to get the
windows user name currently logged in. But it gives me the NULL value. I
even tried exec master..xp_cmdshell "ECHO SET %USERNAME%" but it doesnt
help me.
> Does any body have idea how to get the windows user name who is currently
logged from SQL Server.
> Thanks for you help.
> Hemanth
>sql

How to get the value of System::TaskName of a higher up level?

Hi there,

I was wondering how can I get the value of System::TaskName of a higher scope when I have a Master Package that have several sequence task, data flow tasks and execute package tasks. For each task inside this Master Package on the Post-Execute event handler I have a script task that logs the execution of each task.

After running this master package I saw in my db that I have a row for every single tasks executed in the process and not only the tasks that exist in the master package. For instance, for simplicity let's say my master package looks like this:

SQL Task Script
|
Exec Package 2
|
Exec Package 3
|
Exec Package 4


Package 2,3 and 4 have a SQL Task Script with name Execute SQL Task Package 2, Execute SQL Task Package 3, Execute SQL Task Package 4.

Here's what I got in my db:

Execute SQL Task
Execute SQL Task Package 2
Package2
Execute Package 2
Execute SQL Task Package 3
Package3
Execute Package 3
Execute SQL Task Package 4
Package4
Execute Package 4

I see two TaskName variables in the Variable window, one with OnPostExec scope and the other with Execute Package 2 for instance. I want to get the value of System::TaskName with Execute Package 2 scope.

I want to see in my db only the tasks in bold. Any ideas of how can I do this? I hope you understand what I'm trying to achieve.

Thanks!

Each eventhandler has a variable called @.[System:Stick out tongueropogate] which should be all that you need.

System Variables

(http://msdn2.microsoft.com/en-us/library/ms141788.aspx)

I could tell you how to use it but you'll probably learn more by fiddling with it yourself. its fairly self-explanatory.

-Jamie

|||Hi Jamie,

I knew about the Propagate variable and I tried setting it to false for every post-execute event handler in my master package. I still got multiple records in my table.

Then I tried with False at the package level on every subpackage my master package is calling but I got the same results.

Finally, I remove all my post-execute event handlers from my master package and leave just one, at the master package level and set the Propagate to false and I still got all the subtasks logged into my table.

Could you tell me how to use this variable?

Thanks!|||

You need to set it on the eventhandlers that are scoped to the tasks for which you don't want to do any logging. So, if you have a task called "Ricardo's Execute SQL Task" in a child package that you don't want to capture information for, set that task's eventhandlers to ahve System:Stick out tongueropogate=FALSE.

-Jamie

|||Hi Jamie,

Well, I guess I'm doing something wrong because I set to False the Propagate variable on the Execute SQL Task of my first child package and also at the package level. So now, the Post-Execute event handler for these two objects have nothing but I changed the value of Propagate from True to False.

In my parent package, I disabled all the post-execute event handlers except for the Execute Package Task that calls Package 2.

I got 3 rows inserted in my table:

Taskname = Script Task Post-Exec Package 2 - SourceName = Execute SQL Task Package 2
Taskname = Script Task Post-Exec Package 2 - SourceName = Package2
Taskname = Script Task Post-Exec Package 2 - SourceName = Execute Package 2

the values from above are from System::TaskName and System:Tongue TiedourceName

Thanks!

How to get the value of script of various SQLDMO(version 8.0) objects

Hello,
I am working on a project where I want to access and modify some objects of Microsoft SQL 2000 database.
Would someone help me how to do this? I need following informations;
- Script of the checks of a table
- Script of the Indexes of a table
- Script of Key object(Primary or Forign key)
- Script of Permissions of View and Stored procedure

The following code returns no result;

MyTabelClass mytabelClass = new MyTabelClass();

mytabelClass.Naam = table.Name;

mytabelClass.ChecksScript = table.Script(SQLDMO_SCRIPT_TYPE.SQLDMOScript_DRI_Checks,string.Empty,string.Empty,SQLDMO_SCRIPT2_TYPE.SQLDMOScript2_Default);

mytabelClass.IndexesScript = table.Script(SQLDMO_SCRIPT_TYPE.SQLDMOScript_Indexes,string.Empty,string.Empty,SQLDMO_SCRIPT2_TYPE.SQLDMOScript2_Default);


Thanks in advance.
With regards,

Your script is incorrect. Instead of accessing an existing object, you create a new one :

MyTabelClass mytabelClass = new MyTabelClass(); create a new instance.

See this sample:



Dim svr As New SQLServer
svr.Name = "."
svr.LoginSecure = True
svr.Connect

Dim t As Table

Set t = svr.Databases("pubs").Tables("authors")

MsgBox t.Script(SQLDMOScript_DRI_Checks, "", "", SQLDMOScript2_Default)
MsgBox t.Script(SQLDMOScript_Indexes, "", "", SQLDMOScript2_Default)

Groeten/Greetings

How to get the value of script of various SQLDMO(version 8.0) objects

Hello,
I am working on a project where I want to access and modify some objects of Microsoft SQL 2000 database.
Would someone help me how to do this? I need following informations;
- Script of the checks of a table
- Script of the Indexes of a table
- Script of Key object(Primary or Forign key)
- Script of Permissions of View and Stored procedure

The following code returns no result;

MyTabelClass mytabelClass = new MyTabelClass();

mytabelClass.Naam = table.Name;

mytabelClass.ChecksScript = table.Script(SQLDMO_SCRIPT_TYPE.SQLDMOScript_DRI_Checks,string.Empty,string.Empty,SQLDMO_SCRIPT2_TYPE.SQLDMOScript2_Default);

mytabelClass.IndexesScript = table.Script(SQLDMO_SCRIPT_TYPE.SQLDMOScript_Indexes,string.Empty,string.Empty,SQLDMO_SCRIPT2_TYPE.SQLDMOScript2_Default);


Thanks in advance.
With regards,

Your script is incorrect. Instead of accessing an existing object, you create a new one :

MyTabelClass mytabelClass = new MyTabelClass(); create a new instance.

See this sample:



Dim svr As New SQLServer
svr.Name = "."
svr.LoginSecure = True
svr.Connect

Dim t As Table

Set t = svr.Databases("pubs").Tables("authors")

MsgBox t.Script(SQLDMOScript_DRI_Checks, "", "", SQLDMOScript2_Default)
MsgBox t.Script(SQLDMOScript_Indexes, "", "", SQLDMOScript2_Default)

Groeten/Greetings

How to get the value of number of rows in groupfooter

I want to show how many records populated in the groupby clause, i want to show the number of rows value in the group footer.

Thank you very much.

If you put this in the group footer, you should see the count for each group.

=CountRows()

Hope this helps.

Jarret

sql

How to get the value of a SQL query before binding it to DataGrid?

I am using C#.Net, Visual web Developer, SQL server 2000.

I have a SQL query which I am binding it to a DataGrid.

SQL : "SELECT ord_number, ord_ID, ord_split, ord_Name, ETD_Date, OSP_FSD FROM ORDERS"

In My DataGrid I have a dynamic databound column.

I am able to bind one column to this databound column using following code.

BoundColumn ETDDate = new BoundColumn();
ETDDate.HeaderText = "ETD Date";
ETDDate.DataField = "OSP_FSD";
mygrid2.Columns.AddAt(ETDDate);

but now I want to bind this databound column based on the following criteria to two different database columns.

if(ord_split = 1)
{
ETDDate.DataField = "OSP_FSD";
}
else
{
ETDDate.DataField = "ETD_Date";
}

How to get value of ord_split before binding SQL to teh DataGrid? i.e I just want to take value of ord_split and not all the values of SQL.

Please Help!

HI~

ord_split if different in each row but if you change ETDDate.DataField it will affect all rows.

I am afraid you just want to display OSP_FSD for the rows " ord_split =1 " or ETD_Date if not.

If so you can change the text inGridView'sRowDataBound Event.

How to get the value of a parameter programmatically

Hi,,
Say I have connected to the webs ervice and extracted all the parameters of
a particular report ,,how can I show the default bvalue of those parameter
if any'
thanks for your help,,here is my code:
ReportingService rs = new ReportingService(enviromental_Vars.LocalPath);
rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
//string report = this.cmbReports.Items[this.cmbReports.SelectedIndex].ToString();
bool forRendering = false;
string historyID = null;
ParameterValue[] values = null;
DataSourceCredentials[] credentials = null;
ReportParameter[] parameters = null;
try
{
parameters = rs.GetReportParameters(enviromental_Vars.ReportName, historyID,
forRendering, values, credentials);
if (parameters != null)
{
}
}There is a property on the ReportParameter class with the name of
DefaultValues, and of type string[].
You could use something along the lines of:
foreach(ReportParameter p in parameters)
{
string[] defaults = p.DefaultValues;
// work on defaults...
}
--
Scott
http://www.OdeToCode.com/blogs/scott/
On Fri, 12 Nov 2004 19:12:19 -0800, "ALI-R" <newbie@.microsoft.com>
wrote:
>Hi,,
>Say I have connected to the webs ervice and extracted all the parameters of
>a particular report ,,how can I show the default bvalue of those parameter
>if any'
>thanks for your help,,here is my code:
>ReportingService rs = new ReportingService(enviromental_Vars.LocalPath);
>rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
>//string report =>this.cmbReports.Items[this.cmbReports.SelectedIndex].ToString();
>bool forRendering = false;
>string historyID = null;
>ParameterValue[] values = null;
>DataSourceCredentials[] credentials = null;
>ReportParameter[] parameters = null;
>try
>{
>parameters = rs.GetReportParameters(enviromental_Vars.ReportName, historyID,
>forRendering, values, credentials);
>if (parameters != null)
>{
>
>}
>}
>

how to get the top value?

hi,

this my prediction query.

select Flattened (select $time as Date, [Perf] as Perf from PredictTimeSeries([Perf],100) where $Time <'1/1/2007' ) as A from [Stud_Model] WHERE [StudID]=8

Its giving me result where the date is less than 1/1/2007.i need only one result, where the date should be nearer to 1/1/2007. I am not able to use Top 1 inside like

select Flattened (select top 1 $time as Date, [Perf] as Perf from PredictTimeSeries([Perf],100) where $Time <'1/1/2007' ) as A from [Stud_Model] WHERE [StudID]=8

can anyone help.

Thanks,

Karthik

I haven't tried a query like that, but you can't use Top in that context. You may be able to use the TopCount function, I believe the syntax is

TopCount(<table expression>, <count>, <column-ref>) // the last two may be reversed.

TopCount is itself a table expression.

|||

hi jamie,

Its working cool.

Thanks a lot.

Wednesday, March 28, 2012

How to get the top value of a measure

Dear All,

I need to get the top value of a measure using MDX, i.e. by creating a calculated member what code i need to get the top value?

Please reply,

ghadeer

I think you're looking for the TopCount function.

Chris.

How to Get the SQL Affinity Mask value in Sql 2005, and table that store this info

Hi All

Can u pls tell me How to Get the SQL Affinity Mask value in Sql 2005.

and what is the table/views name that store this info.

for SQL 2000 , we were using following query:

SQLStatement.printf("select c.value from master..sysconfigures c, master..spt_values v,"
"master..syscurconfigs r where v.type = 'C' and v.number = c.config and v.number >= 0 "
"and v.number = r.config and v.name ='affinity mask'");

lErrCode=SQLExecDirect(hStmt,(SQLCHAR*)pszSQLStatement,strlen(pszSQLStatement));

lSQLBindCol(nAffMask);

But With SQL 2005 , we are getting ZERO(0) ROWS SELECTED.

Is there any reason why you can't just exec sp_configure and look at the value for 'affinity mask'?
(you need 'show advanced options' to be turned on for it to show, though)

/Kenneth

How to Get the SQL Affinity Mask value in Sql 2005

Hi All

Can u pls tell me How to Get the SQL Affinity Mask value in Sql 2005.

for SQL 2000 , we were using following query:

SQLStatement.printf("select c.value from master..sysconfigures c, master..spt_values v,"
"master..syscurconfigs r where v.type = 'C' and v.number = c.config and v.number >= 0 "
"and v.number = r.config and v.name ='affinity mask'");

lErrCode=SQLExecDirect(hStmt,(SQLCHAR*)pszSQLStatement,strlen(pszSQLStatement));

lSQLBindCol(nAffMask);

But With SQL 2005 , we are getting ZERO(0) ROWS SELECTED.

you could take a look at the following link in SQL 2005 book online to set the affinity mask

http://msdn2.microsoft.com/en-us/library/ms187104.aspx

Thanks

Sethu Srinivasan [MSFT]

SQL Server Manageability Dev Team

How to Get the SQL Affinity Mask value in Sql 2005

Hi All

Can u pls tell me How to Get the SQL Affinity Mask value in Sql 2005.

for SQL 2000 , we were using following query:

SQLStatement.printf("select c.value from master..sysconfigures c, master..spt_values v,"
"master..syscurconfigs r where v.type = 'C' and v.number = c.config and v.number >= 0 "
"and v.number = r.config and v.name ='affinity mask'");

lErrCode=SQLExecDirect(hStmt,(SQLCHAR*)pszSQLStatement,strlen(pszSQLStatement));

lSQLBindCol(nAffMask);

But With SQL 2005 , we are getting ZERO(0) ROWS SELECTED.

you could take a look at the following link in SQL 2005 book online to set the affinity mask

http://msdn2.microsoft.com/en-us/library/ms187104.aspx

Thanks

Sethu Srinivasan [MSFT]

SQL Server Manageability Dev Team

How to get the returning value of a stored procedure?

Hi everyone!
I am new to sql server 2005 and visual studio 2005.

I have the following simple stored procedure that checks if a user exists:
-------------------------------
ALTER PROCEDURE [dbo].[sp_Users_AlreadyExists]

@.UserName varchar(256)
AS
BEGIN
SET NOCOUNT ON;


IF (EXISTS (SELECT UserName FROM dbo.Users WHERE LOWER(@.UserName) = LoweredUserName ))
RETURN(1)
ELSE
RETURN(0)
END
-------------------------------

I use the following code to execute the procedure on visual studio:
-------------------------------
.
.
.
cmdobj As SqlCommand
cmdobj = New SqlCommand(sp_Users_AlreadyExists, connobj)
cmdobj.CommandType = CommandType.StoredProcedure
cmdobj.Parameters.AddWithValue("@.UserName", "blablalala")
cmdobj.ExecuteNonQuery()
cmdobj.Dispose()
connobj.Close()
.
.
.
-------------------------------

I expected that cmdobj.ExecuteNonQuery() would return 1 if the userblablab exists or 0 if the user doesnt, but it just return -1 (i thinkbecause no row was affected)

Does anyone knows how to retrieve the value that my stored procedure returns?

Thanx in advance!

cmdobj.parameters.add("@.RETURN_VALUE",sqldbtype.int).direction=returnvalue

Then check the parameter value after the execute like:

dim val as integer=cmdobj.parameters("@.RETURN_VALUE").value

sql

How to get the returned value from a stored procedure?

Hi,

I use a strong-typed DataSet to build the data access tier of my application, and the IDE generates most of code for me. However I can't find a way to get the value returned by a stored procedure(The stored procedure seems like 'RETURN 0').I noticed that a @.RETURN_VALUE parameter is added automatically for each query method, but I don't know how to read the value.

Anybody could help me with the problem? Thanks.Big Smile

Hi,

I am assuming you are trying to return the value via VB or C#. You must load your sql command in to a data reader. It loads your values in an an array which is index. Here is an example which returns numerous values and assigns one of the values to a label.

VB:

Dim myConnectionAs SqlConnection
Dim myCommandAs SqlCommand
myConnection =New SqlConnection("Data Source=MYCOMPUTER\SQLEXPRESS;Initial Catalog=MYDATABASEIntegrated Security=True")
myConnection.Open()
' sql statment
myCommand =New SqlCommand("Exec MY_SP", myConnection)
Dim dr = myCommand.ExecuteReader()
Dim iAs Integer = 1

While dr.read()

 Me.lblmel.Text = dr(2).ToString

End While
dr.Close()
myConnection.Close()

C#:

 SqlConnection myConnection;
SqlCommand myCommand;
myConnection =new SqlConnection("Data Source=MYCOMPUTER\\SQLEXPRESS;Initial Catalog=MYDATABASEIntegrated Security=True");
myConnection.Open();
// sql statment
myCommand =new SqlCommand("Exec MY_SP", myConnection);
object dr = myCommand.ExecuteReader();

while (dr.read()) {

this.lblmel.Text = dr(2).ToString;

}
dr.Close();
myConnection.Close();

|||

U can use outparameter to get the value

Thank u

Baba

Please remember to click "Mark as Answer" on this post if it helped you.

How to get the return/execution value of a package from a parent?

Hi there,

I'm trying to get the return value of a package. I see there is a ForcedExecutionValue property which I set using an expression (variable). What I'm executing are 2 packages, Package1 contains an Execute Package Task that calls Package 2. Package 2 contains a Script Task that sets the value of variable Max. I want to get the value of Max in Package 1 then how can I do this?

My first approach is toset the return value of Package 2 = Max and then I thought I could retrieve this value from Package 1 but I'm not able to do that yet.

Any thoughts?

Thanks for any help!The way I would approach this is to use a Script Task (surprise, surprise) to load and execute the package instead of the Execute Package Task. Your script has the ability to read the child packages variables after it has executed, thus allowing child variables to be passed back to the parent.
http://blogs.msdn.com/jamesk/archive/2005/12/21/506463.aspx

Alternatively, you can also have the child package set the parent's variable directly.
http://blogs.conchango.com/jamiethomson/archive/2005/03/17/1151.aspx|||Hi JayH,

Yes, I did the first approach and it worked fine. I'm loading the package from a Script Task and getting the Executables.Count and store this value in a local variable.

Thanks for the suggestion!.

Ricardo

How to get the return value when using a TableAdapter access a Stored Procedure

I have a Stored Procedure

CREATE PROCEDURE test
AS
BEGIN
SELECT Count(*) FROM dbo.test
END

I can using the unbox get the return value

but if i direct return a value form a Stored Procedure like this

CREATE PROCEDURE test
AS
BEGIN
return 100
END

I can not get the VALUE
I do not know how to
Please Help Me
thx

You can use such T-SQL statements to get the result from the stored procedure in SQL Server:

declare @.s int
exec @.s=test
select @.s

How to get the return value when using a TableAdapter access a Stored Procedure

I have a Stored Procedure

CREATE PROCEDURE test
AS
BEGIN
SELECT Count(*) FROM dbo.test
END

I can using the unbox get the return value

but if i direct return a value form a Stored Procedure like this

CREATE PROCEDURE test
AS
BEGIN
return 100
END

I can not get the VALUE
I do not know how to
Please Help Me
thx

Hi,

and welcome to the ASP.NET forums.

You can use aSqlParameter with Direction set toParameterDirection.ReturnValue. Pleasetake a look at this little code sample.

Grz, Kris.

How to get the return value of a stored procedure

I have a Stored procedure (sql 2000), that inserts data into a table. Then, I add this, at the end:
Return Scope_Identity()

I have the parameters for the sProc defined and added to the Command, but I'm having a really lousy time trying to figure out how to get the return value of the Stored PRocedure. BTW - I'm using OleDB instead of SQL due to using a UDL for the connection string.

I have intReturn defined as an integer

I've tried :
Dim retValParam As OleDbParameter = cmd.Parameters.Add("@.RETURN_VALUE", OleDbType.Integer)
retValParam.Direction = ParameterDirection.ReturnValue
intReturn=cmd.Parameters("@.RETURN_VALUE").Value

whenever I add this section - I get an error that there are too many arguments for the sProc.

I've tried:
intreturn=cmd.ExecuteNonquery - tried adding a DataReader - using ExecuteScalar - I've tried so many things and gotten so many errors - I've forgotten which formations go with which errors.

What is the best way to do this in the code part (VB.Net)?

Thanks ahead of time

check the second part ofthis article

|||

Turned out, I didn't even use a parameter for the Returnvalue -

I ended up using something I'd tried before :
lg=cmd.ExecuteScalar....and it worked.

sql