473,503 Members | 1,888 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Windows Form

1 New Member
Expand|Select|Wrap|Line Numbers
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using System.Data.OleDb;
  10. namespace Form2
  11. {
  12.     public partial class Form1 : Form
  13.     {
  14.         public Form1()
  15.         {
  16.             InitializeComponent();
  17.         }
  18.  
  19.         private void patientBindingNavigatorSaveItem_Click(object sender, EventArgs e)
  20.         {
  21.             this.Validate();
  22.             this.patientBindingSource.EndEdit();
  23.             this.tableAdapterManager.UpdateAll(this.patientDataSet);
  24.  
  25.         }
  26.  
  27.         private void patientBindingNavigatorSaveItem_Click_1(object sender, EventArgs e)
  28.         {
  29.             this.Validate();
  30.             this.patientBindingSource.EndEdit();
  31.             this.tableAdapterManager.UpdateAll(this.patientDataSet);
  32.  
  33.         }
  34.  
  35.         private void Form1_Load(object sender, EventArgs e)
  36.         {
  37.             // TODO: This line of code loads data into the 'patientDataSet.patient' table. You can move, or remove it, as needed.
  38.             this.patientTableAdapter.Fill(this.patientDataSet.patient);
  39.  
  40.         }
  41.  
  42.  
  43.  
  44.         private void submit_Click(object sender, EventArgs e)
  45.         {
  46. string s="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\Users\\rhema\\Documents\\Visual Studio 2008\\Projects\\Form2\\Form2\\patient1.mdb;
  47.     OleDbConnection conn=new OleDbConnection(s);
  48.             conn.Open();
  49.             int patient_id=int.Parse(TextBox1.text);
  50.             string name=TextBox2.text;
  51.             string guardians=TextBox3.text;
  52.             int weight=int.Parse(TextBox4.text);
  53.            int heigtht=int.Parse(TextBox5.text);
  54.            string sex=TextBox6.text;
  55.             string address=TextBox7.text;
  56.             int phoneno=int.Parse(TextBox8.text);
  57.             OleDbCommand cmd=new OleDbCommand("insert into patient values("+patient_id+",'" +name+",'" +guardians+",'" +weight+",'" +Height+",'" +sex+",'" +address+",'" +phoneno+"')",conn); 
  58.             conn.Close();
  59.  
  60.  
  61.         }
  62.     }
  63. }
im getting 2 errors as NewLine constant and ; missing in the line string s="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\Users\\rhema\\Documents\\Visual Studio 2008\\Projects\\Form2\\Form2\\patient1.mdb;
pls help me
Apr 17 '12 #1
1 1951
rekedtechie
51 New Member
Expand|Select|Wrap|Line Numbers
  1. //i think you forgot to put a double quote at line 46..
  2.  
  3. String s = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\folder\\sub folder\\sub folder\\sub folder\\yourDB.mdb";
  4.  
  5. //and maybe you can use the @ to scape all characters you want to scape?.
  6.  
  7. //like this..
  8. String s = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\folder\sub folder\sub folder\sub folder\yourDB.mdb";
  9.  
Apr 18 '12 #2

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

Similar topics

6
5716
by: Hamed | last post by:
Hello I have employed as a developer in a software company that its team uses FoxPro / VB 6.0 / VC++ 6.0 as the developing tools and newly is going to migrate to VS.NET. There is a project...
5
6569
by: Xarky | last post by:
Hi, I am creating a windows form, and when a specified event occurs (button click), I am hiding the windows form and opening a new windows form. When opening the new windows form and closing...
5
11342
by: Dave | last post by:
How do I check in a Windows Forms app if any controls have changed? I have a form that collects data, and I want to prompt the user if they try to exit the app, or load a new file, without saving...
9
2799
by: Rajat Tandon | last post by:
Hello there, I am relatively new to the newsgroups and C#. I have never been disappointed with the groups and always got the prompt replies to my queries.This is yet another strange issue, I am...
4
1827
by: Michael C# | last post by:
I have a Windows Form I want to add to another form similar to the way you add an OpenFileDialog to a Windows Form from the Toolbox. Thx
6
2034
by: Dean R. Henderson | last post by:
I have a DTS Package I am able to execute successfully from a Windows Form application, but I cannot get this to work from an ASP.NET Web Service, although the Web Service impersonates the same...
8
18618
by: Alison | last post by:
Hi, Al I am trying to design a user interface which provides both menus and toolbars for some users to click on whatever they want to do, at the same time, I would like to have a console window...
4
3130
by: Rod Gill | last post by:
Hi, I have a form that when opened in the designer appears of the screen. The form selector can't be dragged (or resized) and if I scroll right and down to centralise it the form simply jumps...
9
12821
by: mohit.akl | last post by:
Hey guys & gals I am havng trouble modifying the control box. I want to make the maximise button invisible and have minimisise button instead of it. Like this _ X (not like _ o X ) How...
7
9333
by: Jwe | last post by:
Hi, I've written a program which has both a command line interface and Windows form interface, however it isn't quite working correctly. When run from command line with no arguments it should...
0
7205
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7093
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...
0
7287
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,...
0
7348
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...
1
7006
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7467
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4685
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...
0
3166
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1519
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.