Hello,
I'm trying my first application for a mobile device. I'm doing it up for a pocket pc 2003 device, and all this app does is take a value that's in a textbox (a barcode string), and INSERT it into a test DB that has a single table and a single field just for this purpose. When I run it on the virtual pocket PC emulator it works fine, but when it's actually on the hardware device I've got, no go. The device is running off our wireless network, gets an IP, and can make a terminal services connection with the DB server. I can ping the device from my workstation. When I look at SQL profiler I don't see any attempted connections from the device however, but I do see connections from the emulator when I try from there. This is probably something really stupid bear in mind - this is my first *attempt* at a mobile app, and I don't normally work on pocket PC devices either. Any ideas?
Here's my code (I know I *should* be doing SQL paramaters, I'll fix it after I get this working. This is just how I learned and am most comfortable with still, unfortunately):
private void btnSubmit_Click (object sender, EventArgs e)
{
string myQuery = "INSERT INTO Devices (Barcode) VALUES ('" + this.txtBarcode .Text + "');";
string myConnectionStr ing = "Integrated Security=false; " +
"Server=10.3.0. 72;" +
"Initial Catalog=testDB; " +
"User Id=theUserName; " +
"Password=thePa ssword;" +
"connection timeout=30";
SqlConnection myConnection = new SqlConnection(m yConnectionStri ng);
SqlCommand myCommand = new SqlCommand(myQu ery, myConnection);
try
{
myConnection.Op en();
myCommand.Execu teNonQuery();
MessageBox.Show ("Yup");
}
catch
{
MessageBox.Show ("Nope");
}
}
I'm trying my first application for a mobile device. I'm doing it up for a pocket pc 2003 device, and all this app does is take a value that's in a textbox (a barcode string), and INSERT it into a test DB that has a single table and a single field just for this purpose. When I run it on the virtual pocket PC emulator it works fine, but when it's actually on the hardware device I've got, no go. The device is running off our wireless network, gets an IP, and can make a terminal services connection with the DB server. I can ping the device from my workstation. When I look at SQL profiler I don't see any attempted connections from the device however, but I do see connections from the emulator when I try from there. This is probably something really stupid bear in mind - this is my first *attempt* at a mobile app, and I don't normally work on pocket PC devices either. Any ideas?
Here's my code (I know I *should* be doing SQL paramaters, I'll fix it after I get this working. This is just how I learned and am most comfortable with still, unfortunately):
private void btnSubmit_Click (object sender, EventArgs e)
{
string myQuery = "INSERT INTO Devices (Barcode) VALUES ('" + this.txtBarcode .Text + "');";
string myConnectionStr ing = "Integrated Security=false; " +
"Server=10.3.0. 72;" +
"Initial Catalog=testDB; " +
"User Id=theUserName; " +
"Password=thePa ssword;" +
"connection timeout=30";
SqlConnection myConnection = new SqlConnection(m yConnectionStri ng);
SqlCommand myCommand = new SqlCommand(myQu ery, myConnection);
try
{
myConnection.Op en();
myCommand.Execu teNonQuery();
MessageBox.Show ("Yup");
}
catch
{
MessageBox.Show ("Nope");
}
}
Comment