473,320 Members | 2,117 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Transalation

A.M
Could anybody translate this function into C# please?
Thanks,
Ali
Public Shared Function NzDataReader(ByVal v As Object, Optional ByVal z As
Object = "", Optional ByVal NullClass As String = "System.DBNull")
Try
If v.GetType.ToString = NullClass Then
Return z
Else
Return v
End If
Catch e As Exception
ErrorHandler(e)
End Try
End Function
Nov 15 '05 #1
2 1229
A.M,

Here it is.

public static object NzDataReader(object v, object z, string NullClass)
{
// The return value.
object pobjRetVal = null;

try
{
if (v.GetType().ToString() == NullClass)
pobjRetVal = z;
else
pobjRetVal = v;
}
catch (Exception e)
{
ErrorHandler(e);
}

// Get out.
return pobjRetVal;
}

Now, since optional parameters are not supported in C#, you will have to
declare two overloads:

public static object NzDataReader(object v, object z)
{
// Call the overload.
return NzDataReader(v, z, "System.DBNull");
}

public static object NzDataReader(object v)
{
// Call the overload.
return NzDataReader(v, string.Empty);
}

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"A.M" <IH*******@sapm123.com> wrote in message
news:uZ**************@TK2MSFTNGP09.phx.gbl...
Could anybody translate this function into C# please?
Thanks,
Ali
Public Shared Function NzDataReader(ByVal v As Object, Optional ByVal z As
Object = "", Optional ByVal NullClass As String = "System.DBNull")
Try
If v.GetType.ToString = NullClass Then
Return z
Else
Return v
End If
Catch e As Exception
ErrorHandler(e)
End Try
End Function

Nov 15 '05 #2

Hi Ali,

Does Nicholas's C# code meet your need?
If it does not work on your side, please feel free to tell me.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

51
by: Casper Bang | last post by:
My question is fundamental I beleive but it has been teasing me for a while: I have two classes in my app. The first class is instantiated as a member of my second class. Within this first class,...
4
by: eap90210 | last post by:
Hi to all ng I 'm a non expert user og db2 and i made a program that it connect to db2 and after goes to a table, verify that exists a value and after return success or not. My problem is...
2
by: Mark | last post by:
Hi... We've been doing some basic performance testing comparing asp, asp.net, mono, and php. One of the basic tests is on simply parsing an xml document and streaming the result back to the...
1
by: Evian Spring | last post by:
In .Net 2.0, the resource file is into an XML format which I think is great. However I would like to know if .NET comes with tools that allow you to convert that resource file to a flat text...
3
by: eduwushu | last post by:
Hi there. Im developing a c# app and i have a solution with some projects: the main project which generates the executable file and some other projects which some of them im compiling generate...
5
by: BillCo | last post by:
I'm trying to make the crossover to ADO and I've stumbled into a strange quirk in A2K (mdb, no linked tables). I have a function which generates an INSERT query on the fly and runs it. DAO:...
3
by: =?Utf-8?B?SlIx?= | last post by:
I would like to add text to an image. I have tried to use DrawString and it works on some images but on others it is very very small. I am pretty sure it has something to do with the size of the...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.