Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

concatenate 2 dynamic fields to make a 3

Guest
May 18, 2009 May 18, 2009

I have an ASP form with 3 text fields (vendor number (field1), my part number(field2) & unique number(field3)) what I want to do is build the unique number (third field) by concatenating the vendor number and my part number together when the user clicks the submit button.

Ihave sucessfully built the form to populate the DB with the vendor number and my part number, but have no idea how to get the first two fields to build the third unique field, when the submit action is processed?

Can this be achieved, if so how???

TOPICS
Server side applications
877
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 18, 2009 May 18, 2009

To concatenate 2 fields, just use the VB concatenate operator &

<%
dim var1, var2, var3
var1 = 555
var2 = 999

var3= var1 & var2
response.write (var3)
%>

and use var3 in your update statement.

However, what is the reason for maintaining another field in the db that is simply a concatenation of two other fields already in the db? It is usually not necessary.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
May 19, 2009 May 19, 2009

Thanks for the reply, I understand that I need to use the VB concatenate operator '&'.

My problem is that I'm not up to speed with ASP and VBscript so I don't understand the all the code that has been generated by the record insertion form wizard to figure out what I should be using as the variables to allow the form to dynamically build this field upon the user clicking the submit button, would it help any if I posted the code.

I'm trying to create this third field by concatenating field 1 & 2 is that I need to create a unique field as I am unable to have an auto numbering field as you would get in Access, SQL, etc... as I'm using DB2 running on an IBM AS/400 (i/z series) and according to the DBA's this is not how the AS/400 works and how they programme things to run, apparently something to do with "DFU'ing" a file (the process of tidying / removing obsolete data in the file) would delete the recond numbering field resulting in a file with missing record number i.e. it would end up being a non sequential numbered file wihch then causes problems... I'm taking there word as gospel as they combined have 25+ years worth of programming experience on the AS/400 and know what there doing, but I'm open to suggesstions as to how to get round this problem or challenge there wisdom if there is a way of having an auto numbered field.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 19, 2009 May 19, 2009
LATEST

Sure, post the code and I'll see if I can help. Realize that once you modify the code generated from a server behavior, DW will no longer recognize it as server behavior code so you will need to maintain it manually.

But again, what is the reason for needing a unique field rather than using a 2 part primary key and foreign keys?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines