By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,610 Members | 1,697 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,610 IT Pros & Developers. It's quick & easy.

How to IMPORT MS EXCEL worksheet in Kanji (Japanese) to db2/400

P: 1
Hi all,

Please guide me, I am involved in migration of some of the Excel files of MS EXCEL ( Japanese - Kanji ) into DB2/400.

I am new to this env so If I am asking foolish question, forgive me!

Regards
Jai
Aug 20 '07 #1
Share this Question
Share on Google+
2 Replies


docdiesel
Expert 100+
P: 297
Hi Jai,

I'm not familiar with DB2 on AS/400, but if I had to copy the data into my DB2 on Linux, I'd do something like the following:
  1. Create a new DB on the AS/400 using UTF as Charset (need UTF-16 for Kanji?)
  2. Install a DB2 runtime client on my PC
  3. Catalog the remote db on my PC as ODBC source
  4. Tell my Excel sheet to refer to a table in the remote db (via odbc)
  5. Copy/paste via Excel the data from source sheet to destination table, or maybe use a macro

Regards,

Bernd
Aug 20 '07 #2

P: 1
How to Import Data from Excel into AS/400?

Import Excel to Datagrid first(SQL):
Dim str As String = ""
str = " Provider = Microsoft.Jet.OLEDB.4.0;"
str = str & " Data Source = " & Trim(Me.txtFileName.Text) & ";"
str = str & " Extended Properties=Excel 8.0;"
con = New OleDbConnection(str)
con.Open()
cmd = New OleDbCommand("select * from [sheet1$] ", con)
dr = cmd.ExecuteReader
Me.grdImportDoc.Rows.Clear()
If dr.HasRows Then
While dr.Read
'Me.grdImportDoc.Rows.Add(dr("#"), dr("#"), dr(""), dr(""), dr("COST/M"), dr("QUANTITY"))
If dr(0).ToString = "" Then
Exit While
End If
Me.grdImportDoc.Rows.Add(dr(0), dr(1), dr(2), dr(3), dr(4), dr(5))
End While
End If


Save to AS/400:
If grdImportDoc.Rows.Count = 0 Then
MsgLbl.Text = "Please import data in grid"
Else
For T = 0 To grdImportDoc.Rows.Count - 1
var1 = Trim(grdImportDoc.Rows(T).Cells(0).Value & "")
var2 = Trim(grdImportDoc.Rows(T).Cells(1).Value & "")
var3 = Trim(grdImportDoc.Rows(T).Cells(2).Value & "")
var4 = Trim(grdImportDoc.Rows(T).Cells(3).Value & "")
var5 = Convert.ToDecimal(grdImportDoc.Rows(T).Cells(4).Va lue & "")
var6 = Convert.ToInt32(grdImportDoc.Rows(T).Cells(5).Valu e & "")
ds = New DataSet
AScon = New OdbcConnection(AS400Str)
MsgLbl.Text = "Records in processing"
AScon.Open()
AScmd = New OdbcCommand("insert into Severname.Lib name.File name (Fields) values ('" & var1 & "','" & var2 & "','" & var3 & "','" & var4 & "'," & var5 & "," & var6 & ")", AScon)
AScmd.ExecuteNonQuery()
Next
MsgLbl.Text = "Records are added successfully in AS400"
AScon.Close()
End If
Aug 30 '07 #3

Post your reply

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