Hi,
Can you use
int blah = Convert.ToInt32(cmd.ExecuteScalar());
When the sproc's last statement does:
RETURN @value
I can only get it to work if it does:
SELECT @value
Also, this gives me a object null exception:
int blah = (int)cmd.ExecuteScalar();
isn't convert.toint32 and (int) the same thing but one is a wrapper of the ...
I have a batch of sql statements such as ...
insert into.... ;
insert into.... ;
delete .........;
etc
When i try to execute them against oracle it gives me this error (ORA-00911 Invalid Character)
now i can understand that this is because of the semicolon between the statements, i tried this on SQL Server and it worked but in Oracle...
How can I use DbCommand.ExecuteScalar from F#? It returns an obj which I need to convert to an int. I'm very new to F# and the casting I need to do is not clear.
let (stockid:uint32) = command.ExecuteScalar()
Compile Error:
Type constraint mismatch. The type obj is not compatible with type uint32
Upcasting using :?> throws a runt...
The following method in a static class gives me a time out exception because the connection pool is maxed out.
While in debug mode I looked in sql Management studio and saw there were 150 sleeping processes.
I expected the connections to be closed automatically...I also tried putting as a static member and still got the same Error.
A...
I have a SQL query which returns only one field - an ID of type INT.
And I have to use it as integer in C# code.
Which way is faster and uses less memory?
int id;
if(Int32.TryParse(command.ExecuteScalar().ToString(), out id))
{
// use id
}
or
int? id = (int?)command.ExecuteScalar();
if(id.HasValue)
{
// use id.Value
}
or
int...
i have form view i wrote this code in event sqlds_inserted
text1.text=e.Command.ExecuteScalar().ToString();
to have the id for the last inserted record
it works but every time i add record it inserts tow records with the same data
when i delete this code
it works fine
...
Does ExecuteScalar close the connection automatically?
...