0

我使用备忘录编辑来显示地址,所以它包含 4 行。如何获得这 4 行以及如何将其存储在 Access 数据库中?通常,如果它的 EditText 我们使用此代码来存储

string inno = textEdit12.Text.ToString();
OleDbCommand top = new OleDbCommand("INSERT INTO invoice_top(invoice_number,order_number,customername,status,subtotal,tax,total,[date]) VALUES (" + inno + "," + odrno + ",'" + name + "',"+ chk1 +" ,"+ subtottal +","+ tax +","+total+",'"+date+"')", conn);
top.ExecuteNonQuery();

此代码适用于 EditText。如何为 MemoEdit 获取和存储它???帮我。

4

1 回答 1

1

你必须:

  1. 在 Access 数据库中使用备注列
  2. 使用参数sql查询

代码:

'Suppose you have 2 columns , A - a Memo one, B a DateTime one:
dim SIRCON as string = "your connection string"
Using conn As New OleDbConnection(SIRCON)
  conn.Open()
  Try
  Using cmd As New OleDbCommand("INSERT INTO MYTABLE (A, B)  VALUES (?,  ?)", conn)
    cmd.Parameters.AddWithValue("P_A", textEdit12.Text.ToString())
    cmd.Parameters.AddWithValue("P_B", DateEdit1.EditValue)

    cmd.ExecuteNonQuery()
  End Using
Finally
 conn.Close()
End Try

结束使用

于 2013-11-14T08:38:14.483 回答