473,385 Members | 1,782 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.

Insert command is not working

Hi,
I have written a simple code in VB.NET and using MSACCESS.


1-Try
sqlstr = "INSERT INTO acbill (acbillno,acbilldate,amt,type,drawnby,status,amtre main,designation) VALUES ('" & txtacbillno.Text & "',#" & txtacbilldate.Text & "#," & txtamount.Text & ",'" & ddldepart.SelectedItem.Text & "','" & ddldrawnby.SelectedItem.Text & "','" & ddlstatus.SelectedItem.Text & "'," & txtamount.Text & ",'" & ddldesignation.SelectedItem.Text & "')"

2- Dim Cmd As New OleDb.OleDbCommand(sqlstr, con)
3- Dim RESULT As Integer
4->>>> RESULT = Cmd.ExecuteNonQuery()
5-
6- Catch e1 As Exception
7- Response.Write(e1.ToString)
8- End Try


The same code is running on my office computer but not on my computer.
previously database shows that it is read-only. then i made a new database with same name and deleted the previous data. Now still i m having the same problem -- line no 4 is showing error.But the insert command is running in MACCESS SQL query window.
If i m running the vb.net code and my database is open then it shows error that some one else is using the database and you r not allowed to open it.I have made connection on page_load and close it on page_unload
Apr 8 '07 #1
2 1079
Ganon11
3,652 Expert 2GB
This question belongs in the .NET forum.
Apr 8 '07 #2
MMcCarthy
14,534 Expert Mod 8TB
This question is being moved to the .NET forum.

ADMIN
Apr 10 '07 #3

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

Similar topics

9
by: Bennie | last post by:
Hi all, I have a little problem. def tekst_in(self, tag): tekst_tag={'p': '\t\t<p>\n\n\t\t</p>\n', 'br': '<br />'} print tekst_tag works fine in my class But...
7
by: iqbal | last post by:
Hi all, We have an application through which we are bulk inserting rows into a view. The definition of the view is such that it selects columns from a table on a remote server. I have added the...
3
by: Gtbntgar | last post by:
Please can someone look at my SQL command it is not working. It is giving me a syntax error Act = request.form("Act") NT = request.form("NT") Set Conn =...
2
by: Andy_HR | last post by:
i have a table named tblClanovi now i would like to make a sql insert into command that will add new record in the database... Private Sub btnSpremi_Click() Dim broj Dim imepr broj =...
3
by: Shapper | last post by:
Hello, I have created 3 functions to insert, update and delete an Access database record. The Insert and the Delete code are working fine. The update is not. I checked and my database has all...
1
by: ssims | last post by:
I'm working with ASP.Net on IIS 5.1 and MSSQL 2000 and have a rather frustrating problem. I'm trying to insert a record to a table, get the identity value, and insert two additional records to a...
4
by: Mark Olbert | last post by:
I am struggling with trying to retrieve the value of an autoincrement identity field after a DetailsView Insert operation. The DetailsView is bound to an SqlDataSource control. So far as I can...
3
by: Dilruba | last post by:
asp, vbscript, Ms Access I am using vbscript to insert & update ms accees. Insert operation is working , but update operation is not working. I have used the following codes: ...
5
by: =?Utf-8?B?bXBhaW5l?= | last post by:
Hello, I am completely lost as to why I can't update a DropDownList inside a DetailsView after I perform an insert into an object datasource. I tried to simply it down to the core demostration:...
4
by: =?Utf-8?B?RXJpYyBGYWxza2Vu?= | last post by:
We’re storing our main entity in an insert only table which stores the history of past revisions, but we’re facing problems with storing this history as LINQ will only update the entity, and...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
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
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...

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.