473,320 Members | 2,193 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

how do I open a sql database connection for mobile device while running vb emulator?

2
I've been trying to open a connection to my sql database so i can add new rows and make edits to already existing rows. On the ~conn.Open();~ part i keep getting an expection thrown about the sqlinternalconnection... how do i fix this code or is there something i need to change in vb or the sql server settings themselves?

Expand|Select|Wrap|Line Numbers
  1. string pName = textBox6.Text.Trim();
  2.             string pMobile1 = textBox5.Text.Trim();
  3.             string pHome = textBox3.Text.Trim();
  4.             string pBusiness = textBox2.Text.Trim();
  5.             string pEmail = textBox1.Text.Trim();
  6.             string pCategory = comboBox1.SelectedText.Trim();
  7.  
  8.  
  9.             Debug.Write("test0 ");            
  10.             SqlConnection conn = new SqlConnection(
  11.                 "Server = CLB125_25; Data Source = \\C:Documents and Settings\\SLU Student\\Desktop\\SmartDeviceProject1\\database1.sdf");
  12.  
  13.             Debug.Write("test1 ");
  14.             SqlDataReader rdr = null;
  15.  
  16.             Debug.Write("test2 ");
  17.             try
  18.             {
  19.  
  20.                 conn.Open();
  21.                 Debug.Write("test3");
  22.  
  23.                 string actionString = "INSERT INTO Contacts(Name, Home_Phone, E-Mail, Address, Mobile, Category) VALUES(" + pName.ToString() + "," + pHome.ToString() + "," + pEmail.ToString() + "," + pBusiness.ToString() + "," + pMobile1.ToString() + "," + pCategory.ToString() + ")";
  24.  
  25.                 SqlCommand cmd = new SqlCommand(actionString, conn);
  26.  
  27.                 cmd.ExecuteNonQuery();
  28.  
  29.                 rdr = cmd.ExecuteReader();
  30.  
  31.                 while (rdr.Read())
  32.                 {
  33.                     Console.WriteLine(rdr[0]);
  34.                 }
  35.             }
  36.             catch (SqlException d)
  37.             {
  38.                 Console.Write(d);
  39.             }
  40.             finally
  41.             {
  42.  
  43.                 if (rdr != null)
  44.                 {
  45.                     rdr.Close();
  46.                 }
  47.  
  48.                 if (conn != null)
  49.                 {
  50.                     conn.Close();
  51.                 }
  52.             }
  53.  
Nov 5 '09 #1
3 3084
markmcgookin
648 Expert 512MB
At what stage does this exception occour?

Have you hear of a break point? if you hit F9 on a line of code the system will stop when it runs to that line, you can then step through your code using F10 and F11 line by line to see where the error occours.
Nov 9 '09 #2
markmcgookin
648 Expert 512MB
Your problem is that you seem to be trying to connect to an .sdf file on your desktop from the PDA... put the sdf on the emulator itself then connect to it...

i.e. "My Documents\Business\myDatabase.sdf"

If you want to share a folder to get the file on there go to the options for the emulator "File > Configure" I think.. then add a shared folder from your PC, this will show up as a memory card on the emulator allowing you to move/access files from the PC on the emulator
Nov 9 '09 #3
zakuro
2
This was exactly what i needed. I was able to finish my project with this.
Nov 18 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Jose Gonzalez | last post by:
How to apply a numeric format to a textbox using xhtml? I know you have to use the "-wap-input-format" style tag in css. I can get this to work in a regular xhtml page, however, I've been...
2
by: Schraalhans Keukenmeester | last post by:
After searching for an emulator for the typical cellphone/handheld java applets (do these have a specific name like beans or something?) I arrived at Sun's website and found a download for a...
2
by: Claire | last post by:
Im running a demo database application for a pocketpc device. When it runs in debug mode in the emulator I notice that it also downloads the associated database file with it. I'm using c# in Visual...
3
by: .:.:. igor_sb .:.:. | last post by:
I have to make application for pda's which will communicate through web services... But that's not the problem.. Problem is that I can't get acce3ss to internet in PocketPc Emulator... Same...
6
by: B B | last post by:
Okay, here is what's happening: I have a reasonably fast laptop (1.4 GHz Mobile M, so comparable to 2.5GHz P4) doing .net development. Running Windows XP pro, SP2 IIS is installed and running...
1
by: =?Utf-8?B?V29vZGdub21l?= | last post by:
Hi, I have use the following code to transmit a file back to the browser that worked fine on a HTC_TTyN device running windows mobile 5.0. The code executes in the onclick event of a mobilelist...
1
by: santosh singh | last post by:
for mobile browser i used the following code : Response.ContentType = "application/vnd.wap.xhtml+xml"; Response.AppendHeader("Content-Disposition","attachment; filename=SailBig.jpg");...
2
by: rodmc | last post by:
Hi, I have been scouting around online for information on how to use Python and a GUI toolikit to develop mobile devices. At present I am using wxPython for desktop apps and would like to...
9
by: =?Utf-8?B?RGFuaWVs?= | last post by:
Hi, I downloaded the sample application that the Microsoft video ASPNETAJAXForWinMobile described but it doesn't work on my Windows Mobile 6 emulator. After enabling the script error reporting...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.