|
Hi,
i need your help. i search "how to check toner level in printer using c# and SNMP protocol.
Please give me your ideas.
thanks a lot.
|
|
|
|
|
Check the SNMP-documentation; not all printers will provide the functionality, and I doubt that there will be much copy/pastable solutions out there.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
alexalexalex1907 wrote: check toner level in printer
Read the documentation for the printer (whatever it is) and/or check with whomever the manufacturer is.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
|
|
|
|
|
SNMP is a protocol just like http (just http) is.
Knowing SNMP however tells you absolutely nothing about solving your problem. Just as knowing nothing but http would not allow you to interact with a web site.
So you must learn more about the specific printer, and driver software and version.
|
|
|
|
|
now i wont be able to code this with examples on the internet, right?
String snmpAgent = "ipAddressOfPrinter";
String snmpCommunity = "public";
SimpleSnmp snmp = new SimpleSnmp(snmpAgent, snmpCommunity);
Dictionary<SnmpSharpNet.Oid, AsnType> result = snmp.Get(SnmpSharpNet.SnmpVersion.Ver1, new string[] { "OidOfPrinter" });
if (result == null)
{
MessageBox.Show("Request Failed", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else
{
foreach (KeyValuePair<SnmpSharpNet.Oid, AsnType> entry in result)
{
textBox1.Text = entry.Key.ToString() + " = " + SnmpConstants.GetTypeName(entry.Value.Type) + " (SysDesc.): " + entry.Value.ToString() + "->" + SnmpConstants.SMI_APPSTRING;
textBox1.Text += "SysName: "+entry.Key;
}
}
Here is the connection to the printer. I can get the name, software, oid of the printer but i cant check its status(if it is online, paper jam, offline, toner low, etc.) how can i get theese properties?
Thanks a lot
|
|
|
|
|
|
Hi
i want to store and retrieve objects of any kind to SQL server database, i did the following, inside the database table, i had created a field of type varbinary(MAX),
and in the code, i had made the following to store the object
object treatment = dataGridViewDrugList.Rows;
MemoryStream memStream = new MemoryStream();
StreamWriter sw = new StreamWriter(memStream);
sw.Write(treatment);
dataRow[0] = memStream.GetBuffer();
and it was successful,
now i am not able to retrieve the object back
any ideas?
modified 11-Oct-12 10:32am.
|
|
|
|
|
Try to 'serialize' the object, as opposed to simply trying to wildly dump it's contents. There's an example using the XmlSerializer on MSDN; once it works, you replace the XmlSerializer with a BinaryFormatter and you're done.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
|
Here[^] it is. Serialization may take some getting-used-to, but it's more versatile than dumping memory.
I'd recommend building it in two separate steps; First, create a small console-app to serialize a random object. Once that works, you should be able to switch between Xml-serialization and binary with ease.
Second part would be to store that "information" in a database. That will work the same way for any information; if you get stuck once you're there, simply come back and we'll look at it again
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
Thanks, i solved the issue,
my error was that i was trying to serialize an object of type DataGridViewRowCollection
which is not marked as a Serializable object, i made my custom class which marked as Serializable, i had stored all the data in the DataGridViewRowCollection in that class,
now everything is OK
thanks again,
|
|
|
|
|
i want to create 3 tier architecture in asp.net and c# using stored procedure
tannu
|
|
|
|
|
tannu dwivedi wrote: i want to create
Okay so go ahead and do that. Did you maybe have some sort of a question that you wanted to ask?
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
modified 11-Oct-12 10:48am.
|
|
|
|
|
..and you're looking for a tutorial? Did not find anything on Google? Perhaps you'd like to start with Tier 1[^] and work your way up from there?
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
|
Hi Developers
How We Can Stop SQL Injection With Delegate ?
Please Help ME Thanx
|
|
|
|
|
You can't that makes no sense whatsoever.
You stop SQL Injection attacks (mainly) by using named parameters.
|
|
|
|
|
Really Really Thank you For Helping ME .
Thank You Very Much BUT I Do That Before With Creating Delegate And I Think one Code Can Do Faster And This is Why i Sent That Question.
|
|
|
|
|
Use a parameterized query[^]; the word 'delegate' is out of place here.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
Proper validations inside a parameterized stored procedures can help reduce SQL injection.
|
|
|
|
|
|
Hi All Developers I have A Problem :
How I can Change Opacity Of a Control IN Windows Application C#.net .. I Know How I can Change Form Opacity But How we can Change Control Opacity Like A button.
Thanx Developers
|
|
|
|
|
Why Are All Your Questions Written In Title Casing? It Looks Really Dumb In Normal Sentences. Stop It.
|
|
|
|
|
The native button doesn't support transparancy.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
the transparece color on the form can be used for this if he choses the transparece color to be the same of the button? or this would just make a hole in the form?
(like when you set the transparece color to be white and put a textbox on the form)
the form is really the only control that suport transparece?
I'm brazilian and english (well, human languages in general) aren't my best skill, so, sorry by my english. (if you want we can speak in C# or VB.Net =p)
|
|
|
|