|
Hi,
I am using System.IP.Ports namespace to connect to modem from my application.
If I connect to modem(55.6) at 115200 I get message from modem, otherwise(greater or less that 115200) not getting any message from modem.
Can anyone tell me what all setting need to be done using the API for it to accept the connection at other speeds.
Thanks
|
|
|
|
|
hi
I want the C # application that I can receive faxes through the modem system.
But I do not know how to do this. Please help me
email : javad.asadi@yahoo.com
|
|
|
|
|
Hi,
I have the following function that checks a database field for DBNull.Value. If it contains DBNull.Value, the it should return "", otherwise the string.
This is my calling function (objCustomer is an instance of the Customer class):
objCustomer.AddressLine1 = Globals.CheckStringForDBNulls(objDr["Address1"]);
This is my static function:
public static string CheckStringForDBNulls(string strCheckString)
{
if(strCheckString.Trim() == DBNull.Value)
return "";
else
return strCheckString.Trim();
}
Something tells me that my parameter string strCheckString is of the wrong type.
Please can someone help me correct this error/problem that I am having.
Regards.
-- modified at 5:45 Thursday 20th October, 2005
|
|
|
|
|
ma se wrote: objCustomer.AddressLine1 = Globals.CheckStringForDBNulls(objDr["Address1"]);
Try This
ma se wrote: objCustomer.AddressLine1 = Globals.CheckStringForDBNulls(objDr["Address1"].ToString());
======================
ma se wrote: if(strCheckString.Trim() == DBNull.Value)
return "";
else
return strCheckString.Trim();
TRY THIS
ma se wrote: if(Convert.IsDBNull(strCheckString.Trim()))
return "";
else
return strCheckString.Trim();
AMJ (With "Z" Factor)
|
|
|
|
|
|
if(strCheckString.Trim() == DBNull.Value)
return "";
else
return strCheckString.Trim();
======
This can be reduced to ONE LINE IF STATEMENT explore your self and reduce your LOC Cost
AMJ (With "Z" Factor)
|
|
|
|
|
If I were to convert a null value coming from a database to something else, would this be good enough? I do not know to what date I should convert if it contains no values, so I chose 1900/01/01. Any ideas?
public static DateTime CheckDateForDBNulls(DateTime dtCheckDate)
{
if(Convert.IsDBNull(dtCheckDate))
return Convert.ToDateTime("1900/01/01");
else
return Convert.ToDateTime(dtCheckDate);
}
Calling function is:
objCustomer.StartDate = Globals.CheckDateForDBNulls(Convert.ToDateTime(objDr["StartDate"])); // Check for DBNull value
I get a horrible error:
Object cannot be cast from DBNull to other types.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidCastException: Object cannot be cast from DBNull to other types.
Please can you help again.
-- modified at 7:06 Thursday 20th October, 2005
|
|
|
|
|
objCustomer.StartDate = Globals.CheckDateForDBNulls(Convert.ToDateTime(objDr["StartDate"]));
Instead of implementing this, try this one
objCustomer.StartDate = Globals.CheckDateForDBNulls(objDr["StartDate"].ToString());
==========
In your static function try this
public static DateTime CheckDateForDBNulls(String dtCheckDate)
{
if(Convert.IsDBNull(dtCheckDate) && IsDate(dtCheckDate)==true)
return System.Date.MinValue;
else
return Convert.ToDateTime(dtCheckDate);
}
AMJ (With "Z" Factor)
|
|
|
|
|
objCustomer.StartDate = Globals.CheckDateForDBNulls(Convert.ToDateTime(objDr["StartDate"]));
Instead of implementing this, try this one
objCustomer.StartDate = Globals.CheckDateForDBNulls(objDr["StartDate"].ToString());
==========
In your static function try this
public static DateTime CheckDateForDBNulls(String dtCheckDate)
{
if(Convert.IsDBNull(dtCheckDate) || IsDate(dtCheckDate)==false)
return System.Date.MinValue;
else
return Convert.ToDateTime(dtCheckDate);
}
AMJ (With "Z" Factor)
|
|
|
|
|
As the value can be different types of objects, use the object base class, and check the type of the object:
public static string CheckStringForDBNulls(object strCheckString) {<br />
if (strCheckString is DBNull) {<br />
return string.Empty;<br />
} else {<br />
return ((string)strCheckString).Trim();<br />
}<br />
}
---
b { font-weight: normal; }
|
|
|
|
|
Hi,
I tried the following function, but it doesn't want to work:
//*********************************************************************
//
// CheckStringForDBNulls Static Method
//
// The CheckStringForDBNulls method checks if a string contains a value, if not it
// returns DBNull.Value, or the value of the string.
//
//*********************************************************************
public static DBNull CheckStringForDBNulls(string strCheckString)
{
if(strCheckString.Trim() != string.Empty)
return strCheckString.Trim();
else
return DBNull.Value;
}
Could you please let me know what I am doing wrong? This is used to check the parameter being added, if it contains nothing, the make the value DBNull.Value, or use the value of thr string.
Thanks
BRENDAN
-- modified at 5:46 Thursday 20th October, 2005
|
|
|
|
|
the return type of this method is DBNull, so you can only ever return a null value..
i suspect you don't really need a static method to perform this check, and could probably get away with something like this instead :
if(string.IsNullOrEmpty(strCheckString))<br />
object = DBNull.Value;<br />
else<br />
object = strCheckString;
|
|
|
|
|
I want to put this into a function because I have a 20 checks, and the code can get very long.
Please put the above mentioned code in a function.
|
|
|
|
|
I don't know how well it would work but you could try making your method return Object
|
|
|
|
|
This was how I initially had it, I just thought there might be another way. But thanks for your help, I appreciate it!!
|
|
|
|
|
Hi,
During the last days i strugled around with a strange problem.
I need to play an video on a 3D-Object. That doesnt sound that hard. I created an device as common, added some data to the vertex buffer and activated the texture support of the Video Class:
video.TextureReadyToRender += new TextureRenderEventHandler(video_TextureReadyToRender);<br />
video.RenderToTexture(device);
Immediatly after the RenderToTexture call, the TextureReadyToRender Event was fired and I was able to render my desired scene. So far so goo, no problems at all. It works absolut perfectly
But when I want to close my application I'm not able to clean up. Everytime when me (or the framework) wants to call the Dispose() method, an NullReferenceException is throwed.
I googled around a lot but couldn't find an answer. Does someone know perhaps an easy example? I tried to work with the Example from MDX-SDK(Summer2004), but because of the complicated framework structure I wasn't able to figure out too much. Does anyone have the same problem?
|
|
|
|
|
Hi all,
I want to know how can i encrypt the whole XML file, it means that the data inside this file can't be understood with any user if he try to open this file (Ex.112364896fgdf64965)
if anyone know please help me
|
|
|
|
|
Take a look at the System.Security.Cryptography namespace.
---
b { font-weight: normal; }
|
|
|
|
|
Hi,
i saw this namespace and i didn't found what i want , it makes only encryption for XMLElements and i want to incrypt the whole file to be in octet stream
Thanks for your help
|
|
|
|
|
There is no special method for encrypting an xml document. Just get the xml document as a string, and encrypt it.
---
b { font-weight: normal; }
|
|
|
|
|
Thanks alot for your help
|
|
|
|
|
i am working with c# console application.i am using MInternetExplorer.Explorer class of SHocVw.dll.basically i am parsing html pages.i am using following events as per my requirement
BeforeNavigate2()
DocumentComplete()
i would like to resolve the IP address of website.i used the following code for resolving IP Address
IPHostEntry IPHost =Dns.Resolve("http://www.yahoo.com");
// after that code is not executing
IPAddress[] addr=IPHost.AddressList;
for(int i= 0; i
|
|
|
|
|
Amit_CDAC_Grover wrote: Dns.Resolve("http://www.yahoo.com");
Hostnames do not include the http:// part.
xacc-ide 0.0.99-preview7 now with C#, C, C++, IL, XML, Nemerle, IronPython, Perl, Caml, SML, Ruby, Flex, Yacc, Java, Javascript, Lua, Prolog and Boo highlighting support!
|
|
|
|
|
i have also tried with Dns.Resolve("www.yahoo.com") but that is also not working.
Amit Grover
CDAC R&D
Gist Group
pune
|
|
|
|
|
This code runs fine on my machine
IPHostEntry entry = Dns.Resolve("www.google.com");
Console.WriteLine(entry.AddressList[0].ToString());
Does your computer have a DNS server configured? When you ping www.yahoo.com, do you see the IP Address in the response?
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|