Hi
Can anyone tell me where I have gone wrong with the following code : it runs
without errors, but does not insert the record in the table!
Private Sub Button3_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button3.Click
Dim myConnection As SqlClient.SqlCo nnection
Dim myCommand As SqlClient.SqlCo mmand
Dim insertCMD As String
myConnection = New SqlConnection _
("Data Source=.\SQLEXP RESS;AttachDbFi lename=|DataDir ectory|" _
+ "\Bata_CallInfo .mdf;Integrated Security=True;U ser
Instance=True")
myConnection.Op en()
insertCMD = "Insert into CallLog (AccessCode) values ('18002');"
myCommand = New SqlCommand(inse rtCMD, myConnection)
myCommand.Execu teNonQuery()
myConnection.Cl ose()
End Sub
VB.net 2005 Express, SQL Server 2005 Express, Windows XP Professional
"AccessCode " is a field name of type (VarChar(17))
Thanks
Michael Bond 1 1039
Hi
ignore this question ...... there is nothing wrong with the code ......
I did not realise with vb.net 2005 I had to contend with "design time" and
"run time" copies of the databse .......
Not to worry, I'm really quite pleased. I've been using these discussions
groups for 3-4 years and have received much valuable help ..... and this is
the first time Ive answered a posting (even if it is my own!!!)
"mabond" wrote:
Hi
Can anyone tell me where I have gone wrong with the following code : it runs
without errors, but does not insert the record in the table!
Private Sub Button3_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button3.Click
Dim myConnection As SqlClient.SqlCo nnection
Dim myCommand As SqlClient.SqlCo mmand
Dim insertCMD As String
myConnection = New SqlConnection _
("Data Source=.\SQLEXP RESS;AttachDbFi lename=|DataDir ectory|" _
+ "\Bata_CallInfo .mdf;Integrated Security=True;U ser
Instance=True")
myConnection.Op en()
insertCMD = "Insert into CallLog (AccessCode) values ('18002');"
myCommand = New SqlCommand(inse rtCMD, myConnection)
myCommand.Execu teNonQuery()
myConnection.Cl ose()
End Sub
VB.net 2005 Express, SQL Server 2005 Express, Windows XP Professional
"AccessCode " is a field name of type (VarChar(17))
Thanks
Michael Bond
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: xMANIGHTx |
last post by:
I'm new to DTS. I read some docs before adventuring into this matter.
I still haven't found in all the docs I read if there is some "built-in" DTS
task or function or wathever, to do a mixed "insert/update" import from a
source, giving a unique field as primary key.
I'll try to be more specific. The problem I would like to solve is this:
I have a source file (csv) but it could be any source. I must check this
file for all the records and...
|
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 servers using
sp_addlinkedserver on both database servers.
When I call the Commit API of oledb I get the following error:
Error state: 1, Severity: 19, Server: TST-PROC22, Line#: 1, msg:
|
by: efgh |
last post by:
I'm fairly confident in my knowledge of SQL but I'm stumped with regards
with an Insert Into statement in Access 2003. I've got a 4 column table
that I've simplified about as much as I can, no primary key, no indexes(at
least I don't think I have any), allow duplicates, allow zero length fields,
the fields in the new table are of the same type of the fields in the old
table, etc. Maybe someone can give me an idea as to what I'm doing...
|
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 the necessary
records in it when testing it. I get the error "No value given for one
or more required parameters." when I try to update the database.
Can you tell me what am I doing wrong?
|
by: nsitnikov |
last post by:
Hi,
Here is the problem that I'm trying to solve. I have a DetailsView on
the page, which is set to work in Edit Mode. On insert it adds a record
to SQL Server 2000 database. Everything is working nice and dandy on
Windows 2000 machine, which is where my development environment
installed. This INSERT is also working ok on any other 2000 machine
that I tried it on. But the same page is not working under Windows XP
machines, giving me...
| |
by: mahajanvit |
last post by:
Hi one and all
I got this problem during my project. So in order to solve this I made
a very small application. I am trying to insert using SP and
sqldatasource control. I know that while using sqldatasource control,
there is no need of opening and closing a connection. Also there is no
need to write connection string. When i am selecting table from
sqldatasource and writing insert statement in C# code, its working
fine. When I am...
|
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:
connectionString = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=c:\progam files\mail.mdb"
|
by: LouiseR |
last post by:
I just recently tried to use a multi-row insert on a table that contains a
timestamp column, but I get SQLCODE -180 even though I'm positive that the
value that I'm trying to insert is correct. The error message is : " THE DATE,
TIME, OR TIMESTAMP VALUE *N IS INVALID". Any ideas?
|
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:
default.aspx:
|
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 not reinsert it with a
different revision number.
Compounding the issue, we’ve also got an associated table storing properties
for our entities which is not revisioned, but we still want changes to the
children of our entity (additions, changes...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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,...
|
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...
|
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...
|
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...
|
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...
|
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...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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...
| |