Hi,
Using SQL Server 2000 with Windows 2000 Adv Server
&
Microsoft Access linked table (running stored procedure using ADO as
follows:
************************************************** ********
Private Sub cboAddrType_NotInList(NewData As String, Response As Integer)
Dim cnn As ADODB.Connection
Dim cmd As ADODB.Command
Dim prm As ADODB.Parameter
Dim msg As String
On Error GoTo Err_AddrType_NotInList
'Exit the procedure if the combo box was cleared
If Trim(NewData) = "" Then Exit Sub
'Confirm that the user wants to add AddrType
msg = "'" & Trim(NewData) & "' is not in the list." & vbCr & vbCr
msg = msg & "Do you want to add it?"
If MsgBox(msg, vbQuestion + vbYesNo) = vbNo Then
'If the user chose not to add AddrType, set the response
'argument to supress an error message and undo changes.
Response = acDataErrContinue
MsgBox "No record added.", vbOKOnly, "Action Cancelled"
Else
'If the user chose to add AddrType, open a recordset
'using the AddrType table
Set cmd = New ADODB.Command
Set cnn = New ADODB.Connection
cnn.Open "Provider=SQLOLEDB;Data Source=penland01;Initial
Catalog=groomery;Integrated Security=SSPI;"
cmd.ActiveConnection = cnn
cmd.CommandText = "spInsertAddrType"
cmd.CommandType = adCmdStoredProc
Set prm = cmd.CreateParameter("AddrType", adVarChar,
adParamInput, , Trim(NewData))
cmd.Execute Parameters:=prm
'Set Response argument to indicate that new data is being added
Response = acDataErrAdded
cnn.Close
Set cnn = Nothing
End If
Exit_AddrType_NotInList:
Exit Sub
Err_AddrType_NotInList:
MsgBox Err.Description
Response = acDataErrContinue
************************************************** ********
"NewData" is a text string - in this case "Test"
The stored procedure referenced in the code is:
************************************
CREATE PROCEDURE [spInsertAddrType]
(@AddrType [nvarchar](50))
AS
INSERT INTO [groomery].[dbo].[tblAddrTypes]
([fldAddrType])
VALUES
(@AddrType)
GO
*************************************
When I execute this code, I receive the following error
"Cannot update identity column 'fldAddrTypeID'."
fldAddrTypeID is configured as follows:
***************************
Data Type = int
Identity = Yes
Identity Seed = 1
Identity Increment = 1
***************************
The documentation I've found online concerning this error says that it is
produced when you try to supply a value for an identity field without SET
IDENTITY_INSERT on. Obviously I am NOT specifying a value, so I can't
figure why I'm getting this error.
Thanks for any help you can offer.
Todd 1 1111
Hi,
Found the answer elsewhere but thought I'd share it here in case someone
else has this problem.
Access's upsizing wizard created a trigger on tblAddrTypes which (evidently)
was meant to emulate Access's autonumber functionality. Once I deleted that
trigger, everything worked fine.
Todd
"Todd" <in********@MAPSONgroomery.biz> wrote in message
news:T1*****************@newssvr21.news.prodigy.co m... Hi,
Using SQL Server 2000 with Windows 2000 Adv Server & Microsoft Access linked table (running stored procedure using ADO as follows:
************************************************** ******** Private Sub cboAddrType_NotInList(NewData As String, Response As Integer)
Dim cnn As ADODB.Connection Dim cmd As ADODB.Command Dim prm As ADODB.Parameter Dim msg As String
On Error GoTo Err_AddrType_NotInList 'Exit the procedure if the combo box was cleared If Trim(NewData) = "" Then Exit Sub
'Confirm that the user wants to add AddrType msg = "'" & Trim(NewData) & "' is not in the list." & vbCr & vbCr msg = msg & "Do you want to add it?" If MsgBox(msg, vbQuestion + vbYesNo) = vbNo Then 'If the user chose not to add AddrType, set the response 'argument to supress an error message and undo changes. Response = acDataErrContinue MsgBox "No record added.", vbOKOnly, "Action Cancelled" Else 'If the user chose to add AddrType, open a recordset 'using the AddrType table
Set cmd = New ADODB.Command Set cnn = New ADODB.Connection cnn.Open "Provider=SQLOLEDB;Data Source=penland01;Initial Catalog=groomery;Integrated Security=SSPI;"
cmd.ActiveConnection = cnn cmd.CommandText = "spInsertAddrType" cmd.CommandType = adCmdStoredProc
Set prm = cmd.CreateParameter("AddrType", adVarChar, adParamInput, , Trim(NewData)) cmd.Execute Parameters:=prm 'Set Response argument to indicate that new data is being added Response = acDataErrAdded
cnn.Close Set cnn = Nothing End If
Exit_AddrType_NotInList: Exit Sub
Err_AddrType_NotInList: MsgBox Err.Description Response = acDataErrContinue ************************************************** ********
"NewData" is a text string - in this case "Test"
The stored procedure referenced in the code is:
************************************ CREATE PROCEDURE [spInsertAddrType] (@AddrType [nvarchar](50))
AS INSERT INTO [groomery].[dbo].[tblAddrTypes] ([fldAddrType])
VALUES (@AddrType) GO *************************************
When I execute this code, I receive the following error
"Cannot update identity column 'fldAddrTypeID'."
fldAddrTypeID is configured as follows:
*************************** Data Type = int Identity = Yes Identity Seed = 1 Identity Increment = 1 ***************************
The documentation I've found online concerning this error says that it is produced when you try to supply a value for an identity field without SET IDENTITY_INSERT on. Obviously I am NOT specifying a value, so I can't figure why I'm getting this error.
Thanks for any help you can offer.
Todd This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Vissu |
last post by:
Hi,
I am trying to move bulk of data from one table to another (all in the
db). Can I use direct insert method for doing this ?. I want to
reduce my resource consumption (undo tablespaces,...
|
by: Howard Hinnant |
last post by:
I recently asked for a survey of multimap insert with hint behavior, in
support of a paper I'm writing concerning lwg issue 233. My sincere
thanks to Beman Dawes, Raoul Gough, Russell Hind, Bronek...
|
by: serge |
last post by:
I have a scenario where two tables are in a One-to-Many relationship
and I need to move the data from the Many table to the One table so
that it becomes a One-to-One relationship.
I need to...
|
by: 73blazer |
last post by:
Perhaps my thinking is wrong but this is what I have:
1 table (Tab1) with 1 attribute (Attr1)
Attr1 char(16) for bit data
-----------------------------------------------
create trigger...
|
by: Serious_Practitioner |
last post by:
Hello, all, and thank you for your assistance in the past...
Using Access 2000 from the Office 2000 Professional package...
I use INSERT INTO to add some information to a table...nothing...
|
by: yoyo |
last post by:
DOes anybody have a working example of how do make this work?
I've tried everything I could find, Clara patch, many non-working
examples using pack, baseencode, addslashes, str_replace, bin2hex,...
|
by: Ted |
last post by:
OK, I tried this:
USE Alert_db;
BULK INSERT funds FROM 'C:\\data\\myData.dat'
WITH (FIELDTERMINATOR='\t',
KEEPNULLS,
ROWTERMINATOR='\r\n');
|
by: abracad_1999 |
last post by:
I am trying to populate a table with the following insert query run
through phpmyadmin. When I attempt to run it phpmyadmin just freezes.
After a while "Fatal error: Maximum execution time of 300...
|
by: mdboldin |
last post by:
I hav read on this forum that SQL coding (A) below is preferred over
(B), but I find (B) is much faster (20-40% faster)
(A)
sqla= 'INSERT INTO DTABLE1 VALUES (%d, %d, %d, %f)' % values...
|
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,...
|
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...
|
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,...
|
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: 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,...
|
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: 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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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 ...
| |