Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2014-02-24
1
Medium Priority
?
182 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 2000 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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

705 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