Solved

Using recordsets or equivelant in vb express working with sql server tables

Posted on 2014-02-24
1
171 Views
Last Modified: 2014-02-28
I am working vb express 2010 and connected to an SQL server in Management Studio Express 2008.

I need to lookup each instance of startdate in tbl_1 and check every row of tbl_2, inserting a the downtime code from tbl_1 when the downtimecode is not currently null

tbl_1

ID     StartDate      StopDate       StopTime    DowntimeCode

1       2014-01-01   2014-01-02         24                     3
2       2014-01-02   2014-01-03         31                     6
3


tbl_2

ID     StartDate      StopDate       StopTime    DowntimeCode
         2014-01-01                                                          3
         2014-01-01                                                          3
         2014-01-02                                                          6

I must do this procedure from vb.

Thankyou very much for your assistance.
0
Comment
Question by:SweetingA
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 500 total points
ID: 39885207
You can populate two datatables in vb.net and then use following code


For i As Integer = 0 to dTable1.Rows.Count - 1
  dTable2.DefaultView.RowFilter = "StartDate='" & dTable1.Rows(i).item("StartDate")
  if dTable2.DefaultView.Count > 0
     dTable1.Rows(i).Item("DowntimeCode") = dTable2.DefaultView.Item(0).Item("DowntimeCode")
  End If
Next

Open in new window



*Untested code
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question