|
Yeah, get a USB to Serial converter cable.
BTW, it's Parallel ports that are obsolete. Machines and motherboards are still coming with Serial ports.
|
|
|
|
|
thanks !! I will think this option !!! Thanks Dave.
|
|
|
|
|
tsw1985 wrote: This is because I'm using a barcode gun, for windows it is a keyboard. If you
are writing a e-mail and I use the barcode gun, you can see numbers in you email
when you are writing. I want avoid that.
That doesn't sound like a real business requirement.
Hypothetically...
This is a cash register app that allows it to scan items, issues receipts and can also send email to other stores.
Now if the clerk is typing an email why would they pick up the scanner and use it?
Conversely what if the clerk wants to send the email and then put the scan code in the email...so they write some text, scan a product (which puts the code in the email) and then they write some more.
So in the one case you have a scenario that just will not happen. And then you 'fix' it. And that completely precludes the second scenario.
|
|
|
|
|
After reading your post and the replies, my recommendation is to buy a second computer (even something as simple as a Fit-PC or a Plug PC) to run the app. It could then interact with the main PC via a Web Service or something.
|
|
|
|
|
Hi every one! I want to know how to send sms using GSM modem. i mean connecting a 3G enabled mobile phone in to our computer through USB and sending SMS using C# application. advance thanks for all!!! please help me.
|
|
|
|
|
I don't know how to do the connect to 3G phone via usb for sms, but you could try this company, it has an api that allows two way sms communication. Clickatell
|
|
|
|
|
Hi All
I am trying to create a generic method for calling stored procedures
I would like to pass in the Parameters in via an array
At the moment i am having trouble adding the parameters to the SqlCommand
This is what i have so far
Can anyone advise
thanks
Simon
Calling the method
string[] paramNames = new string[1];
paramNames[0] = "@date = 2012-1-1";
string err="";
WriteToDatabase("exec LoadData", CommandType.StoredProcedure, paramNames, out err);
Method
public static bool WriteToDatabase(
string sql,
CommandType commandType,
string[] paramNames,
out string errorText)
{
bool success = false;
errorText = "";
try
{
using (SqlConnection connection = new SqlConnection(ConnectionString))
{
connection.Open();
List<SqlParameter> parameters = new List<SqlParameter>();
foreach (string paramName in paramNames)
{
parameters.Add(new SqlParameter() { ParameterName = paramName });
}
using (SqlCommand command = new SqlCommand()
{
Connection = connection,
CommandText = sql,
CommandType = commandType,
Parameters = parameters
})
command.ExecuteNonQuery();
connection.Close();
}
}
|
|
|
|
|
Well, you have supplied as the value for paramName @date = 2012-1-1 . That's not a parameter name, that's a parameter name and associated value. Also, what type is your parameter?
|
|
|
|
|
si_69 wrote: I am trying to create a generic method for calling stored procedures
Normally that isn't a good idea. It adds complexity and does not have a significant impact on maintenance costs.
si_69 wrote: Can anyone advise
So if you still want to do it...
1. You must create a sql statement dynamically with matching parameter place holders corresponding to those in the collection(array.) So you are creating SQL dynamically.
2. You must then create a SqlCommand with at sql. Then you populate it the parameters with the collection.
|
|
|
|
|
0) It probably shouldn't be static.
1) You should probably not keep creating the Connection and Command -- create one and hold onto it (in the closed state).
2) Where does ConnectionString come from?
3) Here's your code with a few changes. It compiles, but it's untested:
public static bool WriteToDatabase(
string sql,
System.Data.CommandType commandType,
out string errorText,
params System.Tuple<string,object>[] values
)
{
bool success = true;
errorText = null;
using (System.Data.IDbConnection connection = new System.Data.SqlClient.SqlConnection(ConnectionString))
{
try
{
using (System.Data.IDbCommand command = connection.CreateCommand() )
{
command.CommandText = sql ;
command.CommandType = commandType ;
foreach (System.Tuple<string,object> param in values )
{
System.Data.IDbDataParameter p = command.CreateParameter() ;
p.ParameterName = param.Item1 ;
p.Value = param.Item2 ;
command.Parameters.Add(p);
}
connection.Open();
command.ExecuteNonQuery();
}
}
catch ( System.Exception err )
{
success = false ;
errorText = err.ToString() ;
}
finally
{
connection.Close();
}
}
return ( success ) ;
}
WriteToDatabase
(
"blah blah blah"
,
System.Data.CommandType.Text
,
out error
,
new System.Tuple<string,object> ( "@date" , System.DateTime.Now )
) ;
|
|
|
|
|
hi everyone i was wondering how to load a textfile into textbox on a windows application, and also when it is loaded, edit the data and save any changes made via a second form. many thanks
|
|
|
|
|
|
Set the MultiLine property of TextBox to True as given here
http://msdn.microsoft.com/en-us/library/12w624ff.aspx[^]
for showing and editing multiple lines. Then the following code can be used to read all the text from the inputFile to the TextBox and then to save the modified text from the TextBox to the outputFile
TextBox1.Text = System.IO.File.ReadAllText(inputFileName);
System.IO.File.WriteAllLines(outputFileName, TextBox1.Text);
|
|
|
|
|
+5 for short and to the point answer
Happy Coding...
modified 12-Apr-12 3:06am.
|
|
|
|
|
|
You need StreamReader to read the data from file and show into text box, Here is the code snippet for that:
sr = new StreamReader(filename);
while (!sr.EndOfStream)
{
if (txtBox.Text.Trim() == "")
{
txtBox.Text = sr.ReadLine();
}
else
{
txtBox.Text = txtBox.Text + Environment.NewLine + sr.ReadLine();
}
}
Note: TextBox Should be Multiline, replace the "filename" with your file location and you must include:
using System.IO;
Now for saving the data, you need to write the text of textbox in file. For that ou need StreamWriter. For this You can take the reference from following link:
http://msdn.microsoft.com/en-us/library/8bh11f1k.aspx[^]
Happy Coding...
|
|
|
|
|
Hi all
I am having a picture box with a world map image of size 1800*3600 in it. Now I would like to create heat maps at different points based on latitude and longitude positions and the intensity of heat maps should be different for each point.
can anyone help me in designing the above said feature
thanks
|
|
|
|
|
|
The key point is, I think, to map or translate the GPS coordinates with the XY coordinates of your image.
image top left = XY (0,0) and corresponds to GPS (?, ?)
bottom right = XY (3600, 1800) and corresponds to GPS (?, ?) (assume x=3600 and y=1800)
(and everything in between).
You might want to opt to move the base (XY 0,0) with the GPS 0,0.
Hope this helps.
V.
|
|
|
|
|
Do you have a specific question?
|
|
|
|
|
I have load a xml file data to application. which is the best way to load the data 1) dataset load 2) XML Serialization 3) XMLDocument
Xml has defined data only, but have around one mb data...
|
|
|
|
|
I use XmlDocument, but it depends on your needs.
|
|
|
|
|
|
|
I want to integrate my Window application with Google Map to show the users(Which are basically locations) of my application in he Google map along with the tool tip to show whether a certain user/location has marked his attendance or not
|
|
|
|