|
There is an error in your code.
Which we can't see.
So we can't help you to fix it.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
You are right.
Now bring you an excerpt of code example as well as I understand reading on various forums and on msdn microsoft.
This is just one example of the assembly, but follows closely the structure of the actual rate.
I verified the functionality of the assembly first with a pgm in C # and then with SQLServer and functioning properly, but when calling the Store procedures that invoke assembly from different connections, both local and remote, as a result I have what I have written previously.
using System;
using System.Runtime.InteropServices;
using System.Text;
namespace MyNamespace
{
public class MtClassofFunction
{
private static MyLib2ExternalDllFunction.Function myLib = new MyLib2ExternalDllFunction.Function();
static public SqlIn32 MyFunction1(SqlChars szValue, SqlInt32 lValue)
{
Int32 l_value=0;
int rs=myLib.Function1(args[]);
.....
return (SqlInt32) l_value;
}
static public SqlInt32 MyFunction2(SqlInt32 lValue1, SqlInt32 lValue2)
{
Int32 rs=0;
int value=myLib.OtherFunction(args[]);
... do something
return (SqlInt32)rs;
}
}
Please help me
Thanks
|
|
|
|
|
Well that code won't compile - what is args[] supposed to be?
Try marking the myLib field as readonly , in case you're inadvertently changing the reference somewhere else.
Make sure your code is thread-safe, since SQL will be calling it from multiple threads.
If you still can't find the error, then you'll need to debug your code:
Walkthrough: Debugging a SQL Server CLR Integration User-Defined Scalar Function[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hi, everyone,
For some odd reason, I cannot figure this one out.
I'm writing an unmanaged application, in assembly language. Most of the application works fine,...it's really just a big COM application for accessing .NET Framework classes by calling COM interface methods that expose these methods.
To summarize: I've done all the set-up. I've loaded the Version 4 CLR and MsCorLib in my Default Domain. I've retrieved COM pointers for several assemblies that I've loaded in the AppDomain (System, System.Core, and System.Web). I've retrieved COM pointers for various types and methods contained within the System Assembly, by first calling, _Assembly.GetTypes, and, then calling various _Type methods. This all works well.
Now, I'm at the point when I'd like to access some information from the: System.Net.NetworkInformation Namespace, which is largely contained in System Assembly. I am able to retrieve a _Type pointer to System.Net.NetworkInformation.IPGlobalProperties, and, to NetworkInformationPermission, but, I am failing to get a return from _Type.GetProperty for either of these .NET objects.
Do I need to call the constructor on these .NET objects first, before accessing properties and methods ??? Or, am I using the
Binding Flags incorrectly ??? I think I've tried every possible combination (of BindingFlags), and I still get a returned pointer with a NULL value.
I'd post some code,...but, it really is a large amount of source (most of it is irrelevant to this problem),...and, well,...it's in assembly language.
modified 19-Aug-16 17:13pm.
|
|
|
|
|
Well, one class is abstract, the other is sealed; contrast that with the ones that ARE working for you.
|
|
|
|
|
Line 260: newCandidate.FirstNameAR = txtFirstNameAR.Text.Trim();
Line 261: newCandidate.LastNameAR = txtLastNameAR.Text.Trim();
Line 262: newCandidate.DOB = Convert.ToDateTime(txtDOB.Text);
Line 263: newCandidate.Address = txtAddress.Text;
Line 264: newCandidate.CountryID = Convert.ToInt16(ddlCountry.SelectedValue);
Click here, for more details[^]
|
|
|
|
|
Why have you posted this with a link to your QA post? Please post questions in one forum only.
|
|
|
|
|
sorry for that, plz help me.
|
|
|
|
|
|
You can't set a DateTime to null.
".45 ACP - because shooting twice is just silly" - JSOP, 2010
- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
|
That's not what I would call a reasonable practice. I prefer my DateTimes to be valid in some way (and use new DateTime(0) to accomplish that).
".45 ACP - because shooting twice is just silly" - JSOP, 2010
- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
John Simmons / outlaw programmer wrote:
That's not what I would call a reasonable practice. |
It is a possible and valid scenario, whether you John, agree with it or not. Just saying...
For instance, shipping dates - they are usually null until something actually ships.
|
|
|
|
|
We can argue the validity of nulls all day. I don't like 'em, and I strive to resolve them in some way.
".45 ACP - because shooting twice is just silly" - JSOP, 2010
- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
One would use a "shipped event", in that case.
One could drop and smash the shipment .... One does not carry a null "damaged date" in anticipation.
|
|
|
|
|
I don't think you would set a DateTime to string.empty .
|
|
|
|
|
Of course you can't. But I don't know how they are working with the actual data and displaying it. I am starting to regret posting an answer to his question. 
|
|
|
|
|
Slacker007 wrote: I am starting to regret posting an answer to his question.
Waaa-waaaa-waaaaaaaaaaa.
".45 ACP - because shooting twice is just silly" - JSOP, 2010
- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
You know John, you don't "always" have to be an a**hole.
|
|
|
|
|
Yes. Yes, I do. If I wasn't always an assh*le, I would disappoint my legions of fans. Besides, me being an assh*le is really the only constant in life any more that absolutely EVERYBODY can count on.
Beyond that, I was just poking you in the ribs. If you're honestly butt-hurt, I can call a waaa-mbulance for you.
BTW, I'm the one that voted your original answer a 5.
".45 ACP - because shooting twice is just silly" - JSOP, 2010
- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
|
Why are you yelling at me?
|
|
|
|
|
Read the whole thread - the answer is there.
".45 ACP - because shooting twice is just silly" - JSOP, 2010
- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
Actually (to build on Slacker's answer), the return value of the TryParse method is either true or false, and if true, the specified out parameter contains the parsed DateTime value. If the return value is false, the specified string was not in a recognizable DateTime string format.
Additionally, if you know for sure what the format of the string will be, you can use ParseExact .
For details about using either of these methods, google is, once again, your friend.
".45 ACP - because shooting twice is just silly" - JSOP, 2010
- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
Thanks, I corrected my post.
Funny, I use this all the time, yet I posted its implementation incorrectly. 
|
|
|
|
|