473,399 Members | 3,038 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,399 software developers and data experts.

help 'e debug

33
I wrote the below code to input new data from name and address textbox of a form to microsoft access but there are alot of error. the name of the table in the access is Hotel and the the fields are HotelName and HotelAddress . Please can somebody help me and debug. i used vb.net


Expand|Select|Wrap|Line Numbers
  1. Private Sub submitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  2.  
  3.  
  4.         Dim Objconn As New SqlClient.SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ECBInvoicing.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True")
  5.         Objconn.Open()
  6.  
  7.         ObjCmd = New SqlCommand("INSERT INTO hotel (HotelName, HotelAddress) VALUES (@HotelName, @HotelAddress)", Objconn)
  8.  
  9.  
  10.         ObjCmd.Parameters.Add("@HotelName", Data.SqlDbType.VarChar).Value = txtHotelname.Text
  11.         ObjCmd.Parameters.Add("@HotelAddress", Data.SqlDbType.VarChar).Value = txtHotelAddress.Text
  12.  
  13.  
  14.         ObjCmd.ExecuteNonQuery()
  15.  
  16.  
  17.         Objconn.Close()
  18.  
  19.     End Sub
Jun 21 '07 #1
1 773
nateraaaa
663 Expert 512MB
I wrote the below code to input new data from name and address textbox of a form to microsoft access but there are alot of error. the name of the table in the access is Hotel and the the fields are HotelName and HotelAddress . Please can somebody help me and debug. i used vb.net


Expand|Select|Wrap|Line Numbers
  1. Private Sub submitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  2.  
  3.  
  4.         Dim Objconn As New SqlClient.SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ECBInvoicing.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True")
  5.         Objconn.Open()
  6.  
  7.         ObjCmd = New SqlCommand("INSERT INTO hotel (HotelName, HotelAddress) VALUES (@HotelName, @HotelAddress)", Objconn)
  8.  
  9.  
  10.         ObjCmd.Parameters.Add("@HotelName", Data.SqlDbType.VarChar).Value = txtHotelname.Text
  11.         ObjCmd.Parameters.Add("@HotelAddress", Data.SqlDbType.VarChar).Value = txtHotelAddress.Text
  12.  
  13.  
  14.         ObjCmd.ExecuteNonQuery()
  15.  
  16.  
  17.         Objconn.Close()
  18.  
  19.     End Sub
Could you also post the errors you are receiving?
Jun 21 '07 #2

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

Similar topics

1
by: jasper | last post by:
hi, i am trying to make a very simple program that will just detect and output your currently connected IDE devices. It will look something like this: IDE PRIMARY MASTER: IDE PRIMARY SLAVE:...
3
by: Mahmood Ahmad | last post by:
Hello, I have written a program that reads three types of records, validates them acording to certain requirements and writes the valid records into a binary file. The invalid records are...
1
by: wukexin | last post by:
I write my own class Cfile, I want to know what about implement ctime().Who help me? My use function ctime, I sign it with $$$. my class Cfile: #------------------------ file.h...
9
by: tym | last post by:
HELP!!! I'm going round the twist with this... I have a VB6 application which is using DAO to access a database (Please - no lectures on ADO, I know what I'm doing with DAO!!) Ok, problem...
4
by: VicVic | last post by:
Dear Great Experts, I have a problem and need your help! We have a Flat DLL built in C++ (CCC), and on top of it, we built another DLL built in C# (SSS), which has .Net Assembly. CCC was...
4
by: Marek Krzeminski | last post by:
I am new to ASP and I am having some problems that I hope someone can help me with. I am using WindowsXP and a book to try to learn ASP. The book instructed me to install IIS & .Net Framework...
43
by: ZillionDollarSadist | last post by:
Hello, I'm working at a simple Access '97 + VB4 application, and I ran into a terrible problem: something I never modified now gives me a totally unwanted "Invalid use of null" error. It happens...
0
by: bchirra | last post by:
I am trying to convert following function into .net using System.net.WebRequest class, can any one please help. Thank you very much. Public Function PostForm(ByVal server As String, ByVal CGI As...
2
by: theronnightstar | last post by:
I am writing an anagram program for my fiance. Figured it would be an excellent task to learn from. The way it is supposed to work is it reads in a word list from a file into a temporary...
16
by: Harry Simpson | last post by:
I've been away from ASPNET - I open up a new Web app in VS2008 and go into properties and select to use IIS instead of the personal web server. Then I run in debug mode and it says I have to set...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
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...
0
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
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
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...

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.