|
I have created a Stored Procedure and I am trying to insert in to tables using the stored procedure by passin parameters from the GUI.
My problem is, Stored procedure works fine if I use SqlCommand object. But now I am using OdbcCommand object which is creaing issue whenever I try to insert using the SP's. The error I get when I use OdbcCommand object is "There is no paramter supplied for @PRDD_CustomerICA" which incidentally is the first parameter that I am passing. Parameter Order in SP and frontend code is also similar. Using SqlCommand object works fine which indicates that SP is fine.
I am coping a part of my code with few parameters that I am passing to the SP. Could anyone please let me knw what I am missing? Is there something extra required to do for OdbcCommand object?
bool blnInserted = true;
OdbcTransaction tran = con.BeginTransaction();
OdbcCommand cmd = new OdbcCommand("InsertNewShipment", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@PRDD_CustomerICA", txtBillICA.Text.Trim());
cmd.Parameters.Add("@PRDD_ProductID", intProdID);
cmd.Parameters.Add("@AST_Refnr", txtRef.Text.Trim());
cmd.Parameters.Add("@AST_DefID", intAstDefID);
cmd.Parameters.Add("@AST_StatusID", intShipStatus2ID);
cmd.Parameters.Add("@AST_ICA", txtBillICA.Text.Trim());
cmd.Parameters.Add("@AST_RegionID", intRegID);
cmd.Parameters.Add("@AST_Billable", intBillable);
cmd.Parameters.Add("@AST_ExpirationDate", dtpLicFileExpDate.Value);
cmd.Parameters.Add("@AST_Comments", txtShippingComments.Text.Trim());
cmd.Transaction = tran;
cmd.ExecuteNonQuery();
if(blnInserted == true)
{
tran.Commit();
}
This forum has helped me a lot and I hope I will get an answer soon.
Thanks a lot in advance
|
|
|
|
|
Also I read in MSDN that Parameters for queries involving OleDbCommand and OdbcCommand objects use question marks; queries that use SqlCommand objects use named parameters that begin with an @ symbol.
So I have to use ? instead of @...
I guess I got the solution. If I am wrong please let me know.
Thanks
|
|
|
|
|
The ? marks are used as the replacement characters in the text of a query. They do not apply to stored procedures. The order of the parameters in the collection should however, match the order expected by the stored procedure.
Absolute faith corrupts as absolutely as absolute power
Eric Hoffer
The opposite of the religious fanatic is not the fanatical atheist but the gentle cynic who cares not whether there is a god or not.
Eric Hoffer
|
|
|
|
|
|
hello
i am developing AI chess engine for this purpose i want basic chess programming code in c# i am new in c# so thats why i want help please any one of u can send me C# code or help me in development.
thanks.
|
|
|
|
|
|
Both of those are UI for chess engines. This guy was hoping to find some chess engine written in C#.
Alex Korchemniy
|
|
|
|
|
|
Alex Korchemniy wrote:
Both of those are UI for chess engines.
Are they? You are right about the second one, but Valil.Chess contains port of Java chess engine... or at least that's what article say, but I admit I didn't look at the code. Why would author say something what isn't true.. I assume that engine IS there.
David
David's thoughts / dnhsoftware.org / MyHTMLTidy
|
|
|
|
|
I'm trying to work with combo box, which will display graphically data I store in access DB. Each index no. has a column in the DB. means: choose option with index 1 from drop down list; get data & graph for column 1. Very simple & strait forward. I just cannot seem to grasp the idea of this combo box & what's running it. What is the event which will trigger the change of display? How do I pass item index no. to the method that connected to DB?
You may send me a link to a site where I can view some simple examples of those? I've been looking all over & couldn't find something useful.
sea#
|
|
|
|
|
--------------------------------------------------------------------------
I have a NET problem
In java I ahave made a NetCalculator bla bla and I needed a method
like this one:
public byte [] getBytes ()
{
return InetAddress.getByName(this.ip).getAddress();
}
Now I want to port this in C# all fine but I need to return the
"byte[]" the ".getAddress();" does this but in C# tthe
public byte [] getBytes ()
{
return Dns.GetHostByName(this.ip).AddressList;
}
Returns something else...
How can I convert this to c#?
THX...
--------------------------------------------------------------------------
How About this?How can I convert this java code to c#
public static String nsLookup(String nsl)
{
String nslookup;
InetAddress address = null;
try
{
/* // Get hostname
address = InetAddress.getByName(nsl);
nslookup = address.getHostName();
*/
nslookup = Address.getHostName(InetAddress.getByName(nsl));
}
catch (Exception uhe)
{
nslookup = "unknown";
}
return nslookup;
}
--------------------------------------------------------------------------
(o)(o)
|
|
|
|
|
Hello,
I have developed two versions of an application, with one of them using regular expressions. It's code is much more clear and maintainable, but the problem is the program runs slower. I know there are some rules in building efficient expressions, but I don't have too much expirience using regex. Could you please provide some tips?
Thanks
|
|
|
|
|
Show us the regular expressions and maybe someone can point out some of your inefficiencies. Btw, if you have .* in there then chances are it's gonna be extremely inefficient.
Regards,
Brian Dela
Blog^
Co-author of The Outlook Answer Book... Go on, pre-order^ it today!
Regular Expression Library builder^
|
|
|
|
|
Hi,
create\s+(procedure|function)\s+[\w_\.-]*\s*\(.+\n*\)(.*\n)*?begin(?<fid>(.*\n)+?)end
With this expression I'm trying to retrive the body of a stored procedure. I don't see how to avoid the .* and .+ . Any advices?
Regards
|
|
|
|
|
You can replace all your .*\n with [^\n]* which is the same but more efficient... plus, if you had singleline mode turned on your regex would probably break as it is (or it might be more efficient ith a little tweaking ... depending on what area you are trying to capture. I'd also replace the .+\n with [^\n]+ and you should use named captures and turn on explicit capturing... that should speed up your regex a lot.
Post a few examples of what you want to match and I'll see what I can come up with.
Regards,
Brian Dela
Blog^
Co-author of The Outlook Answer Book... Go on, pre-order^ it today!
Regular Expression Library builder^
|
|
|
|
|
Hi Brian,
Doesn't [^\n] stand for anything but new line character?
Basically I'm trying to get the body of a procedure or function by the name. For example:
create function dbo.user_id(in @user_name char(128) default
null)
returns integer
on exception resume
begin
declare id integer;
select user_id into id
from SYS.SYSUSERPERMS where
user_name = isnull(@user_name,current user);
return(id)
end
What I need is the part between begin and end.
Thanks for helping !
|
|
|
|
|
Anonymous wrote:
Doesn't [^\n] stand for anything but new line character?
Ah, yes... mis read your expression.
This regex will do:
(?smnx-i)begin\n(?<StoredProcBody>.*)end
The body is stored in the named capture StoredProcBody
Regards,
Brian Dela
Blog^
Co-author of The Outlook Answer Book... Go on, pre-order^ it today!
Regular Expression Library builder^
|
|
|
|
|
Dear all,
I am not too sure whether I can post this here.
I hope I am not advertising. I am working on a community project to share to the public on obfuscation.
I had prepared a set of questionnaires and hope you can fill in. I know it is quite trouble some.
http://nos.blogsome.com/2005/07/17/noos-questionnaires/
Thank you.
Cheers.
Regards,
Chua Wen Ching
Visit us at http://www.necoders.com
|
|
|
|
|
now i can get the window handle of the desktop listview , but till now i dont know how to set it to autoarrange icons, is there any way can do this
|
|
|
|
|
Why?
Alex Korchemniy
|
|
|
|
|
coze i am devloping a software that manage desktop icons
|
|
|
|
|
hi, there are two query string i want to combine them
string str = "xyz";
double waist = 123;
string query1 = "delete from Trouser where Company = " + "'" + str + "'";
string query2= "delete from Trouser where Waist = " + waist ;
i want to make them one using "where" clause. plz help me i will be very thankful to u.
|
|
|
|
|
|
i want to redirect (windows logo key +D) to another windows shortcut key (windows logo+M), is there any way to do this using C# ?
|
|
|
|
|
See: RegisterHotKey function in MSDN
Tip: perform a search on google "registerhotkey site:msdn.microsoft.com"
Alex Korchemniy
|
|
|
|