• Some users have recently had their accounts hijacked. It seems that the now defunct EVGA forums might have compromised your password there and seems many are using the same PW here. We would suggest you UPDATE YOUR PASSWORD and TURN ON 2FA for your account here to further secure it. None of the compromised accounts had 2FA turned on.
    Once you have enabled 2FA, your account will be updated soon to show a badge, letting other members know that you use 2FA to protect your account. This should be beneficial for everyone that uses FSFT.

Another VB .NET Question

Magic Hat

n00b
Joined
Mar 17, 2002
Messages
42
Ok what Im trying to do is create records in a loop.
What Im looking for is for the user to enter a start date and end date and have it enter the data into an sql database, increasing the date by a set number of days. Here is my code:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim inputdate, lastdate As Date
inputdate = Me.startdate.Value
lastdate = Me.enddate.Value

Do While inputdate < lastdate

inputdate.AddDays(7)
MsgBox(inputdate)
Loop
End Sub

The problem Im running into is it just keeps outputing the orginal date selected, never actually adding 7 days, and staying within the loop.

The msgbox is just for debugging right now, I want to replace it with code to enter that data in the sql db. Any help would be appreciated
 
Thanks it worked!.

Now time to figure out how to actually add a SQL record in VB.....this is alot harder than the old ms access db :p
 
To add a record you'll need a SqlConnects, SqlDataAdapter, and a DataSet. That is the way I have always done it for viewing and updating records, depending on what you want to do you could use a DataGrid or GridView depending on what version of VB.NET you're using. I've never used 2002 just 2003 and 2005.
 
Back
Top