473,732 Members | 1,948 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

2 New Member
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 sqlinternalconn ection... 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 3102
markmcgookin
648 Recognized Expert Contributor
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 Recognized Expert Contributor
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\Busin ess\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 New Member
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
4656
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 unsuccessful in getting it to work in asp.net 1.1 The following code has allowCustomAttributes set and works fine for labels, but not for textboxes. This is because it is building span tags around the control. I need to embed the class tag inside the...
2
40641
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 runtime which supposedly allows for testing these kind of apps on a pc. I am not at all proficient in Java development, after trying for a while I find I cannot run any of the Java applets I have, which _do_ run properly on my SE K750i cellphone. ...
2
1357
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 Studio .net 2003 How do I do the same thing please? I don't know where to look to find out where that sort of thing's configured.
3
1343
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 project works great on my friends computer... (only differnce is that he has network card in his computer) so I'm asking do I have to have network card so that Emulator can get access to internet? Thanks a lot and sorry because of bad english! ;)
6
8578
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 fine All SQL Servers I am referring to share a small (10 computers or so) LAN with a 100MB Switch. No other computers on the LAN exhibit this problem.
1
2866
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 control. Now on a similar device running window mobile 6.0 the file is not displayed - the link causes a post back succesfully and the code appears to execute - on the browser a bar is displayed breifely at the bottom of the window (although ist...
1
1728
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"); Response.TransmitFile( Server.MapPath("~/images/sailbig.jpg") ); but this code is not able to open "Save as dialog box " on mobile Emulator Browser .Could anyone please tell me How to open "Save as dialog box " in mobile . i am using XHTML ( not WAP ) with...
2
1590
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 continue using that if possible. Anyway, I would like to know what people would recommend for developing mobile applications which can run on Windows Mobile and Mac OS X (iPhone etc)? It would also be cool if the same apps could run where possible (or...
9
3717
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 of the mobile IE, it pops up several JScript error and the ajax behavior is not funtional at all. Where can I look for any possible issue? Thanks.
0
8773
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9445
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9306
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8186
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6733
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6030
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4548
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4805
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2177
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.