473,385 Members | 1,275 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,385 software developers and data experts.

asp.net program is not executing

helloo im swetha working in a software company and im a fresher so i got a problem in asp with vb.net program..
kindly solve my problem..in dis below program there is a error coming at execute non query.
so pls send me the solution...
thanking you,
swetha.

Expand|Select|Wrap|Line Numbers
  1. Imports System.Data
  2. Imports System.Data.OleDb
  3.  
  4. Partial Class _Default
  5.     Inherits System.Web.UI.Page
  6.     Dim objConn As OleDbConnection
  7.     Dim txt_1 As Integer
  8.     Dim txt_2 As String
  9.     Dim txt_3 As String
  10.     Dim strSQL As String
  11.  
  12.     Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  13.         Dim objCmd As OleDbCommand
  14.         Dim strDSN As String
  15.         strDSN = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" _
  16.                      & Server.MapPath("db1.mdb")
  17.         objConn = New OleDbConnection(strDSN)
  18.  
  19.         strSQL = "insert into user_master(user_id,user_name,user_pwd) values (" & txt_1 & " ,' " & txt_2 & ",'" & txt_3 & " )"
  20.  
  21.         objConn = New OleDbConnection(strDSN)
  22.         objCmd = New OleDbCommand(strSQL, objConn)
  23.  
  24.         objCmd.Connection.Open()
  25.         objCmd.ExecuteNonQuery()
  26.         objCmd.Connection.Close()
  27.  
  28.  
  29.         Response.Write("<h3>Record addĄG</h3>")
  30.         Response.Write("Sucessfuly Record Inserted")
  31.         Response.Write("</ul>")
  32.  
  33.  
  34.     End Sub
Jan 24 '08 #1
3 980
kenobewan
4,871 Expert 4TB
Insert syntax incorrect, bad idea inserting id numbers...
Jan 24 '08 #2
radcaesar
759 Expert 512MB
Have a break point on ur strSQL and check that insert query.
Jan 24 '08 #3
DrBunchman
979 Expert 512MB
There are no single quotes around txt_1 in your insert statement which may be the cause of the problem. Also as Kenobewan says be careful that you are not trying to insert into an identity field.

Dr B
Jan 24 '08 #4

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

Similar topics

3
by: chmod000 | last post by:
Hello, I'm trying to use the exec() call in php to run a program that I've written and compiled from C. This program attempts to create a new file and write data into it. If I simply run the...
2
by: Joe Bloggs | last post by:
I have a Windows form application that has a start button, a progress bar and also writes information to the status bar the code is C#. My problem is that when you hit the start button and the...
8
by: lovecreatesbea... | last post by:
K&R 2, sec 2.4 says: If the variable in question is not automatic, the initialization is done once only, conceptually before the program starts executing, ... . "Non-automatic variables are...
4
by: keo982 | last post by:
Hello guys, hope one of you may help. I am trying to find a way of executing a standalone c++ program from the dos window. i have tried to type programname.exe but with no results. am i mistyping...
22
Frinavale
by: Frinavale | last post by:
How To Use A Database In Your Program Many .NET solutions are database driven and so many of us often wonder how to access the database. To help you understand the answer to this question I've...
3
by: =?Utf-8?B?S3VlaXNoaW9uZyBUdQ==?= | last post by:
I have a .NET VC++ program, I want to execute some dos command from the program, e.g. copy some file, and etc. How do I do that?
2
by: sirichennupati | last post by:
hi all, #include<stdlib.h> #include<iostream.h> void main() { cout<<"main1234\n"; system("perl perlsample.pl"); cout<<"invoked"; }
4
by: Jonny Relentless | last post by:
After adding a form to a C# program, I am unable to use it. I want to use form1 as a sort of menu, so that when the user clicks a button, form1 will close and form2 (or form3, etc) will open. What...
87
by: pereges | last post by:
I have a C program which I created on Windows machine. I have compiled and executed the program on windows machine and it gives me the consistent output every time i run it. for eg. input a = 2,...
9
by: Keith G Hicks | last post by:
I'm having a lot of trouble with "file in use" errors in my "folder watcher" project. Starting and stopping the watcher and reading my XML file work fine. Once the watcher is started, I'm reading...
1
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...
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.