Dear All,
After copying a record using an Stored procedure all textfields (nvarchar)
has max lenght !
See VBA-code and SP below
VBA-code tos execute SP
Dim objcommand As ADODB.Command
Dim intReturnParam As Long
Set objcommand = New ADODB.Command
With objcommand
.CommandType = adCmdStoredProc
.CommandText = "FB_CopyOrder"
.Parameters.Append .CreateParameter("return_value", adInteger,
adParamReturnValue)
.Parameters.Append .CreateParameter("ORD_ID", adInteger,
adParamInput, , Me.ORD_ID)
.Parameters.Append .CreateParameter("ORD_P_ID", adInteger,
adParamInput, , Me.ORD_P_ID)
.Parameters.Append .CreateParameter("ORD_PHTI_ID", adInteger,
adParamInput, , Me.ORD_PHTI_ID)
.Parameters.Append .CreateParameter("ORD_NAME", adWChar,
adParamInput, 50, Me.ORD_NAME)
.Parameters.Append .CreateParameter("ORD_CLIENT_CODE", adWChar,
adParamInput, 50, Me.ORD_CLIENT_CODE)
.Parameters.Append .CreateParameter("ORD_INTERNAL_NOTE", adWChar,
adParamInput, 1024, Me.ORD_INTERNAL_NOTE)
.Parameters.Append .CreateParameter("ORD_REQUESTED_DELIVERY_DATE",
adDate, adParamInput, , Me.ORD_REQUESTED_DELIVERY_DATE)
.Parameters.Append .CreateParameter("ORD_REQUESTED_QUANTITY",
adInteger, adParamInput, , Me.ORD_REQUESTED_QUANTITY)
.Parameters.Append .CreateParameter("ORD_AVAILABLE_QUANTITY",
adInteger, adParamInput, , Me.ORD_AVAILABLE_QUANTITY)
.ActiveConnection = CurrentProject.Connection
.Execute
intReturnParam = .Parameters(0).Value
End With
Stored procedure
Alter Procedure FB_CopyOrder
--List of parameters to be added to the parametercollection of the
ADO-commandobject before executing the command
@SourceOrderID int,
@ORD_P_ID int,
@ORD_PHTI_ID int,
@ORD_NAME nvarchar(50),
@ORD_CLIENT_CODE nvarchar(50),
@ORD_INTERNAL_NOTE nvarchar(1024),
@ORD_REQUESTED_DELIVERY_DATE datetime,
@ORD_REQUESTED_QUANTITY int,
@ORD_AVAILABLE_QUANTITY int
as
declare @err int
declare @NewOrderid int
begin tran
-- add new order values = command-parameters
insert into [ORDER] (ORD_P_ID, ORD_PHTI_ID, ORD_NAME, ORD_CLIENT_CODE,
ORD_CREATION_DATE, ORD_INTERNAL_NOTE, ORD_REQUESTED_DELIVERY_DATE,
ORD_REQUESTED_QUANTITY, ORD_AVAILABLE_QUANTITY)
values (@ORD_P_ID, @ORD_PHTI_ID, @ORD_NAME, @ORD_CLIENT_CODE,
convert(varchar,getdate(),101), @ORD_INTERNAL_NOTE,
convert(varchar,@ORD_REQUESTED_DELIVERY_DATE,101), @ORD_REQUESTED_QUANTITY,
@ORD_AVAILABLE_QUANTITY)
set @err = @@Error
select @NewOrderID =SCOPE_IDENTITY()
etc........................................... 1 1957
"Filips Benoit" <be***********@pandora.be> wrote in message
news:G3*********************@phobos.telenet-ops.be... Dear All,
After copying a record using an Stored procedure all textfields (nvarchar) has max lenght !
See VBA-code and SP below
VBA-code tos execute SP
Dim objcommand As ADODB.Command Dim intReturnParam As Long Set objcommand = New ADODB.Command With objcommand .CommandType = adCmdStoredProc .CommandText = "FB_CopyOrder" .Parameters.Append .CreateParameter("return_value", adInteger, adParamReturnValue) .Parameters.Append .CreateParameter("ORD_ID", adInteger, adParamInput, , Me.ORD_ID) .Parameters.Append .CreateParameter("ORD_P_ID", adInteger, adParamInput, , Me.ORD_P_ID) .Parameters.Append .CreateParameter("ORD_PHTI_ID", adInteger, adParamInput, , Me.ORD_PHTI_ID) .Parameters.Append .CreateParameter("ORD_NAME", adWChar, adParamInput, 50, Me.ORD_NAME) .Parameters.Append .CreateParameter("ORD_CLIENT_CODE", adWChar, adParamInput, 50, Me.ORD_CLIENT_CODE) .Parameters.Append .CreateParameter("ORD_INTERNAL_NOTE", adWChar, adParamInput, 1024, Me.ORD_INTERNAL_NOTE) .Parameters.Append
..CreateParameter("ORD_REQUESTED_DELIVERY_DATE", adDate, adParamInput, , Me.ORD_REQUESTED_DELIVERY_DATE) .Parameters.Append .CreateParameter("ORD_REQUESTED_QUANTITY", adInteger, adParamInput, , Me.ORD_REQUESTED_QUANTITY) .Parameters.Append .CreateParameter("ORD_AVAILABLE_QUANTITY", adInteger, adParamInput, , Me.ORD_AVAILABLE_QUANTITY) .ActiveConnection = CurrentProject.Connection .Execute intReturnParam = .Parameters(0).Value End With
Stored procedure
Alter Procedure FB_CopyOrder
--List of parameters to be added to the parametercollection of the ADO-commandobject before executing the command
@SourceOrderID int,
@ORD_P_ID int,
@ORD_PHTI_ID int,
@ORD_NAME nvarchar(50),
@ORD_CLIENT_CODE nvarchar(50),
@ORD_INTERNAL_NOTE nvarchar(1024),
@ORD_REQUESTED_DELIVERY_DATE datetime,
@ORD_REQUESTED_QUANTITY int,
@ORD_AVAILABLE_QUANTITY int
as
declare @err int
declare @NewOrderid int
begin tran
-- add new order values = command-parameters
insert into [ORDER] (ORD_P_ID, ORD_PHTI_ID, ORD_NAME, ORD_CLIENT_CODE, ORD_CREATION_DATE, ORD_INTERNAL_NOTE, ORD_REQUESTED_DELIVERY_DATE, ORD_REQUESTED_QUANTITY, ORD_AVAILABLE_QUANTITY)
values (@ORD_P_ID, @ORD_PHTI_ID, @ORD_NAME, @ORD_CLIENT_CODE, convert(varchar,getdate(),101), @ORD_INTERNAL_NOTE, convert(varchar,@ORD_REQUESTED_DELIVERY_DATE,101),
@ORD_REQUESTED_QUANTITY, @ORD_AVAILABLE_QUANTITY)
set @err = @@Error
select @NewOrderID =SCOPE_IDENTITY()
etc...........................................
It looks like you should be using adVarWChar, not adWChar - the data is
being treated as nchar, not nvarchar, so it's being 'padded out' with
spaces.
Simon This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Caroline |
last post by:
I need to update a table by copying a column from another table
(having the same
structure, but on another database), from the record having the same
primary key.
1 - What is the correct...
|
by: Filips Benoit |
last post by:
Dear All,
After copying a record using an Stored procedure all textfields (nvarchar)
has max lenght !
See VBA-code and SP below
VBA-code tos execute SP
|
by: Ed |
last post by:
Hi,
I have an html page with a div element within a form for dynamically
creating textfields.
The problem is when I click a link on the page, or the submit button,
then click the back button,...
|
by: Jean-Michel POURE |
last post by:
Dear friends,
I studying the possibility to port Compiere CRM from Oracle to PostgreSQL. As
Compiere evolves nearly everyday in CVS, I would like to run the Oracle code
without (too much)...
|
by: Briton |
last post by:
Hi all,
I got a form with 2 unbound textfields.
There are also other fields that are bound to a table.
When I move between the records by click'ing the recordselector, I
want to update the 2...
|
by: Jeff Brooks |
last post by:
I need to copy a record one access record into the same table. I just need
to modify a couple fields that the user will change. Im sure there is an
easy way to do it. I have started just reading...
|
by: jpatchak |
last post by:
Hello,
I have a main form with one subform. I have a command button on the main form to delete the current record. Below is my code. The tables on which the main form and subform are based...
|
by: eureka |
last post by:
Hi folks,
I am working on a webapplication using Jsp and JS.
On my main Jsp(Jsp1) I have a table which is created dynamically
inside a <divand contains all the backend-table's records as rows,...
|
by: f3dde |
last post by:
Hi there,
I have a question about forms in MS Access..
Is it possible in any way at all, to add info in 2 textfields and save it as 1 record.
Detail:
I have a record with 3 fields....
|
by: jacc14 |
last post by:
Hi
I am sure there is an easy way to do this but I have exhausted all avenues.
I have some label data in a table which I want to copy to an identical table. However the first label I may only...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
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
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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: 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...
| |