|
did someboy have a answer of my question please????
|
|
|
|
|
Hi,
Kindly let me know that, How may I get the name of Windows Operation system using C#?
Actually I want to know that, what windows is being used.
Example:
Windows XP
or
Windows Server 2003
or
Windows Server 2008
or
Windows Vista
or
Windows 7
Thank you
(Riaz)
|
|
|
|
|
You need to use the OSVersion Property of the System.Environment Class. Here is an MSDN article on how to do it How to determine the Windows version by using Visual C#[^]. (Hint - it was the first hit in a Google search).
Hope this helps
...and I have extensive experience writing computer code, including OIC, BTW, BRB, IMHO, LMAO, ROFL, TTYL.....
|
|
|
|
|
|
Good Evening All
i have a Function in my DataLayer that is defined like this
public bool SynchProductsCategoryToCBD(IList<EcashProductCatModel> model)
{
con = new SqlConnection(strCon);
cmdinsert = new SqlCommand("sp_AddProductCategory");
cmdinsert.CommandType = CommandType.StoredProcedure;
cmdinsert.Connection = con;
bool Error = false;
try
{
con.Open();
foreach (EcashProductCatModel ecash in model)
{
cmdinsert.Parameters.Add("@CATEGORY_ID", SqlDbType.Int).Value = ecash.CATEGORY_ID;
cmdinsert.Parameters.Add("@CATEGORY_DESCRIPTION", SqlDbType.VarChar).Value = ecash.CATEGORY_DESCRIPTION;
cmdinsert.Parameters.Add("@SCHOOLID", SqlDbType.Int).Value = ecash.SCHOOLID;
cmdinsert.ExecuteNonQuery();
}
Error = true;
}
catch (Exception ex)
{
Logger.LoggerClient logger = new Logger.LoggerClient();
Logger.LoggerModel models = new Logger.LoggerModel();
models.iTYPEID = Convert.ToInt32(GenericEnum.Logging_Type.ECASH_SYCH);
models.sLOGGER_CLASS = "eCashDatalayer";
models.sLOGGER_DESCRIPTION = ex.Message;
models.sLOGGER_FUNCTION = "SynchProductsCategoryToCBD";
models.sLOGGER_LOGGEDINUSERID = "";
models.sLOGGER_PAGE = "NA";
models.sLOGGER_VALUE = "NA";
logger.LogIncident(models);
}
finally
{
con.Close();
}
return Error;
}
and i pass the List of objects, i have inspected the list and it contains valid values and i had 13 records , but in the database i get only 1 record
What is it that i am doing wrong ?
Thanks
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Well, one thing you're doing wrong is that you fail to clear the SqlCommand.Parameters collection between stored proc calls. Just add this line at the top of your foreach loop:
cmdInsert.Parameters.Clear();
".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 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
hi John
thanks reply, that did not work either.
Thanks
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Are you getting an exception?
Have you stepped through the code and seen how many times that foreach actually loops?
|
|
|
|
|
i have change it to look like this
foreach (EcashProductCatModel ecash in model)
{
using (var cmdinsert = new SqlCommand("sp_AddProductCategory", con))
{
cmdinsert.CommandType = CommandType.StoredProcedure;
cmdinsert.Parameters.Add("@CATEGORY_ID", SqlDbType.Int).Value = ecash.CATEGORY_ID;
cmdinsert.Parameters.Add("@CATEGORY_DESCRIPTION", SqlDbType.VarChar).Value =
ecash.CATEGORY_DESCRIPTION;
cmdinsert.Parameters.Add("@SCHOOLID", SqlDbType.Int).Value = ecash.SCHOOLID;
cmdinsert.ExecuteNonQuery();
}
}
and its working perfectly
Thanks
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
The right way is to add the parameters once and set the values each time through the loop.
Create Command
Create and add parameters
Loop
{
Set parameter values
Execute Command
}
|
|
|
|
|
Hi,
I want to display the output of LM35 temperature sesnor on PC in C# but i cannot find the source code for that in C#. Can any one help me?? I am not using any kind of microcontroller.
|
|
|
|
|
Hmm,
From the datasheet you already know that the LM35's output is a voltage increasing by 10mv/degree and it will need connecting to an ADC, as a direct PC connection is not possible. The PC interface, both hardware and software, will be to the ADC.
Alan.
|
|
|
|
|
Yes i have connected it with ADC0804 and did interfacing via parallel port. But i dont know how to display the values on pc.
|
|
|
|
|
1. Read the data from the device
2. Format it into the form that you (or your users) want
3. Write it to the screen
Which of these methods are you having trouble with?
The best things in life are not things.
|
|
|
|
|
I am trying to read the data in C and is giving zero ouput. What does this mean?? Is the power suply not properly given??
|
|
|
|
|
aeman wrote: I am trying to read the data in C and is giving zero ouput. What does this mean?? Is the power suply not properly given??
How can I guess? I have no idea how you have connected this device, whether it is powered on, whether it is working correctly, what sort of commands you send to it, or what responses you receive back. You will have to do some debugging for yourself in order to give us some more information.
The best things in life are not things.
|
|
|
|
|
What's an "LM35 temperature sesnor"?
|
|
|
|
|
|
Quite. Perhaps you could try that for C# code to interface with the parallel port.
|
|
|
|
|
ya well said. After doing that i came here.
|
|
|
|
|
|
yes i did that and i can access the parallel port also but i donot know how to display the values of sensor on pc??
|
|
|
|
|
Then you need to look up the documentation for the device you are interfacing with to find out what it will send you over the parallel port and how you want to represent that.
|
|
|
|
|
Cha, as if.
A while back I got around to buying one of these[^] in hopes that I could use it to sample and store outdoor temperatures. But it doesn't seem accurate and it only provides the temperature of the board, which warms up while it has power.
So I need to devise a way to only give it power when I want to gather a sample.
|
|
|
|
|
Hello Everybody,
I am creating a class in which i want to create a property of Name (Readable and Writable).
Which Will be Unique every time if i will be create this class.
and it will be checking for previous existing Object of Class.
if i create a class like :
Classname clsname = new Classname();
Classname clsname1 = new Classname();
then Output is
clsname.Name = Class1
clsname.Name = Class2
Then pls help me to do this work.
Thanks
If you can think then I Can.
|
|
|
|