adding a row

J

jtnpham

Here is my current coding:

Dim Capacity As Integer

Dim connStr As String = "Provider=Microsoft.jet.oledb.4.0;
Data Source=f:\datawhse database\datawhse.mdb"
Dim sqlStr As String = "Select capacity FROM work_center WHERE
workcenter=" & txtWcSearch.Text
Dim dataAdapter As New OleDbDataAdapter(sqlStr, connStr)
Dim dt As New Data.DataTable
dataAdapter.Fill(dt)
txtWcCap.Text = dt.Rows(0)(0).ToString
Capacity = txtWcCap.Text + 1
dataAdapter.Dispose()

sqlStr = "SELECT WorkCenterId, ShopOrderNumber,
ShopOrderOperation, MachineCode, PartNumber FROM dbo_ShopOrder WHERE
WorkCenterId =" & Chr(39) & txtWcSearch.Text & Chr(39) & " ORDER BY
WorkCenterId, ShopOrderNumber"
Dim dataAdapter2 As New OleDbDataAdapter(sqlStr, connStr)
Dim dt2 As New Data.DataTable
dataAdapter2.Fill(dt2)

Dim Available As Integer

Available = CInt(txtWcCap.Text) - dt2.Rows.Count

txtWcAvail.Text = Available

dataAdapter2.Dispose()

sqlStr = "SELECT dbo_Shoporder.ShopOrderNumber,
authtable.AuthNo FROM authtable INNER JOIN dbo_shoporder ON
authtable.shoporderno = dbo_shoporder.shopordernumber WHERE
dbo_shoporder.workcenterid='" & Convert.ToString(txtWcSearch.Text) &
"' AND authtable.workcenterid='" & Convert.ToString(txtWcSearch.Text)
& "';"
Dim dataadapter4 As New OleDbDataAdapter(sqlStr, connStr)
Dim dt4 As New Data.DataTable
dataadapter4.Fill(dt4)
Dim current As Integer = dt4.Rows.Count
dataadapter4.Dispose()

Dim ds As New Data.DataSet()
sqlStr = "SELECT dbo_Shoporder.ShopOrderNumber,
authtable.AuthNo FROM authtable INNER JOIN dbo_shoporder ON
authtable.shoporderno = dbo_shoporder.shopordernumber WHERE
dbo_shoporder.workcenterid='" & Convert.ToString(txtWcSearch.Text) &
"' AND authtable.workcenterid='" & Convert.ToString(txtWcSearch.Text)
& "';"
Dim dataAdapter3 As New OleDbDataAdapter(sqlStr, connStr)
dataAdapter3.Fill(ds, "orders")
Dim dv As Data.DataView = ds.Tables(0).DefaultView
gvData.DataSource = dv
gvData.DataBind()
dataAdapter3.Dispose()

It is on the displayed table that I would like to add rows to. I
would like the shown table to have a table that consists of rows
equaling the capacity. For the additional rows, I would like to have
the text "available" show up in both columns. Any ideas on how to do
this? I keep reading the help me section for typed datasets in my
visual web developer but it's not helping any =(.

This is the example they give:

Dim newCustomersRow As NorthwindDataSet.CustomersRow
newCustomersRow = NorthwindDataSet1.Customers.NewCustomersRow()

newCustomersRow.CustomerID = "ALFKI"
newCustomersRow.CompanyName = "Alfreds Futterkiste"

NorthwindDataSet1.Customers.Rows.Add(newCustomersRow)

Any help would be great! =)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

GetValue Method? 1

Top