查看: 1273|回复: 4
|
vb.net 数据库求救
[复制链接]
|
|
各位,我的程序打算能让user 输入data进入database,可是现在的问题是程序走完时,跳出窗口说输入成功,可是在数据库里找不到资料。。。我试过很多方法,结果还是一样。。。希望会的人能帮帮我...以下就是我的代码
- Dim adapter As SqlDataAdapter = New SqlDataAdapter("SELECT * FROM Inventory ", CtnLogin)
- Dim builder As SqlCommandBuilder = New SqlCommandBuilder(adapter)
- Dim dataset As DataSet = New DataSet
- adapter.Fill(dataset, "Inventory")
- Dim datatable As DataTable = dataset.Tables("Inventory")
- Dim newRow As DataRow = datatable.NewRow()
- newRow("InventoryNo") = txtInventoryNo.Text
- newRow("StockItemNo") = 1
- newRow("InventoryPrice") = txtPrice.Text
- newRow("InventoryQuantity") = txtInventoryQuantity.Text
- newRow("InventoryMeasurement") = txtMeasurement.Text
- newRow("InventoryProcureMethod") = txtMethod.Text
- newRow("InventoryProcureDate") = Convert.ToDateTime(DateTimePicker1.Value)
- newRow("InventoryExpiryDate") = Convert.ToDateTime(DateTimePicker2.Value)
- newRow("UserNo") = "U001"
- datatable.Rows.Add(newRow)
- adapter.Update(dataset, "Inventory")
- MessageBox.Show("successfully inserted into database", "success info", MessageBoxButtons.OK, MessageBoxIcon.Information)
- CtnLogin.Close()
复制代码 |
|
|
|
|
|
|
|
发表于 21-6-2010 02:26 PM
|
显示全部楼层
不好意思哦!有个小小的问题问你!!你可以拿DATA出来吗?
SELECT * FROM Inventory??? |
|
|
|
|
|
|
|
楼主 |
发表于 21-6-2010 06:54 PM
|
显示全部楼层
回复 2# tatt2
可以拿啊,根据那个"SELECT * FROM Inventory" ,在用datareader 来execute |
|
|
|
|
|
|
|
发表于 12-7-2010 11:06 AM
|
显示全部楼层
|
|
|
|
|
|
|
楼主 |
发表于 17-7-2010 06:24 PM
|
显示全部楼层
谢谢大家尝试帮忙,我已经找到原因了,原来是能走的,只是debugger问题 |
|
|
|
|
|
|
| |
本周最热论坛帖子
|