如何将其他语言(如法语,中文)字符从ASP.NET Gridview插入Oracle表

时间:2018-09-14 10:08:38

标签: asp.net vb.net oracle

我有一些表数据,其中包含法语,中文字符。

例如:ENTRÉÉD25 SBS RAL 7035 MG

我可以使用相同的语言在gridview中显示这些表数据,并且能够基于gridview中的行数动态生成查询,这是正确的。

如果从SQL Developer工具插入,则表示插入正确;如果从.net执行查询,则使用英文字符。

例如:ENTRÉÉD25 SBS RAL 7035 MG,这是作为ENTREE D25 SBS RAL 7035 MG插入的

我动态生成查询是因为每次我的gridview列都会更改。

For j = 1 To totcols - 1
    If Right(GridWFOwner.HeaderRow.Cells(j).Text, 4) = "PREV" Then

    ElseIf GridWFOwner.HeaderRow.Cells(j).Text = "CHANGE_INFO" Then

    Else
        SQL_COL = SQL_COL & "," & GridWFOwner.HeaderRow.Cells(j).Text

        SQL_VAL = SQL_VAL & ",LTRIM(RTRIM('" & Trim(Replace(Replace(Server.HtmlDecode(row.Cells(j).Text), "'", "''"), " ", "")) & "'))"
    End If
Next

SQL_COL = Mid(SQL_COL, 2, Len(SQL_COL))
SQL_VAL = Mid(SQL_VAL, 2, Len(SQL_VAL))

SQL_COL = "ETL_ID," & SQL_COL & "," & "REQUEST_NO,DC_CODE,USER_ID,INSERT_TS"
If ACTION_FLAG = "I" Then
    TOT_SQL = "INSERT INTO DVLX.TABEL1(" & SQL_COL & ") VALUES(SEQ_MAT.NEXTVAL," & SQL_VAL & "," & "'" & uprno & "'" & ",'IBR'," & "'" & Session("user_id") & "'" & ",sysdate)"
Else
    TOT_SQL = "INSERT INTO DVLX.TABEL1(" & SQL_COL & ") VALUES(SEQ_MAT.NEXTVAL," & SQL_VAL & "," & "'" & uprno & "'" & ",'IBR'," & "'" & Session("user_id") & "'" & ",sysdate)"
End If

Dim cmdi As OracleCommand
cmdi = New OracleCommand(TOT_SQL, cnOra)
cmdi.ExecuteNonQuery()

0 个答案:

没有答案