0

我正在使用 vb.net.Having 数据集包含列名作为电话。它包含一组电话号码。我想为每个电话号码添加 0 并将其存储在另一个数据集中。

我的代码

cmd = New OracleCommand("select substr(PHONE,-10)as PHONE from  reports.renewal_contact_t where run_date=to_date('" + TextBox1.Text + "','mm/dd/yyyy') and  EXP_DATE =to_date('" + TextBox2.Text + "','mm/dd/yyyy') and  region not in('TNP')", cn)
ada = New OracleDataAdapter(cmd)
ada.Fill(ds, "reports.renewal_contact_t ")
Dim ds1 As New DataSet
ds1 = ds.Clone()
For Each q In ds.Tables(0).Rows
   phone = z + q("PHONE").ToString
   For Each q1 In ds1.Tables(0).Rows
      q1("PHONE") = phone
   Next
Next

我的问题是没有在 ds1 中获取值。

请帮我纠正它。

4

1 回答 1

1

你应该试试这个

cmd = New OracleCommand("select substr(PHONE,-10)as PHONE from  reports.renewal_contact_t where run_date=to_date('" + TextBox1.Text + "','mm/dd/yyyy') and  EXP_DATE =to_date('" + TextBox2.Text + "','mm/dd/yyyy') and  region not in('TNP')", cn)
ada = New OracleDataAdapter(cmd)
ada.Fill(ds, "reports.renewal_contact_t ")
Dim ds1 As New DataSet
ds1 = ds.Copy()

For Each q In ds1.Tables(0).Rows
    q("PHONE") = "0" + q("PHONE").ToString
Next
于 2012-09-11T09:42:02.683 回答