Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 2008 > BOOK: Visual Basic 2008 Programmer's Reference ISBN: 978-0-470-18262-8
| Search | Today's Posts | Mark Forums Read
BOOK: Visual Basic 2008 Programmer's Reference ISBN: 978-0-470-18262-8
This is the forum to discuss the Wrox book Visual Basic 2008 Programmer's Reference by Rod Stephens; ISBN: 9780470182628
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Visual Basic 2008 Programmer's Reference ISBN: 978-0-470-18262-8 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old June 22nd, 2009, 03:44 PM
Authorized User
Points: 312, Level: 6
Points: 312, Level: 6 Points: 312, Level: 6 Points: 312, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jun 2006
Location: Orpington, Kent, United Kingdom.
Posts: 73
Thanks: 1
Thanked 1 Time in 1 Post
Unhappy Inserting D.B. records programatically ( entering the same value in all records ? )

When I run the following code, it enters the number 1 in every record in the specified field. It should enter the nos. 1 to 144, as I'm sure you can see. Any suggestioins ? ( I've traced the execution step by step, and the value of x increases in increments of 1 as it should ) Please help.[code]
Sub Button1_Click(ByVal sender AsObject, ByVal e As System.EventArgs) Handles Button1.Click
' open the connection.
Dim conn_times24 AsNew OleDb.OleDbConnection(CONNECT_STRING)
' make a command to insert the data
Dim cmd AsNew OleDb.OleDbCommand("INSERT INTO 24hrTimes (Time_Number) VALUES (?)", conn_times24)
' add the numbers 1 to 144 to Time_Number field
Dim x AsByte
For x = 1 To 144
New OleDb.OleDbParameter("Time_Number", x))
' execute the command.
Catch ex As Exception
Next x
lblOP.Text =
" Done ! "

the rest works fine ! just the 'for' loop in question.

Similar Threads
Thread Thread Starter Forum Replies Last Post
Connecting,edit,update & Deleting records from database programatically. sheelnathkekre BOOK: Beginning Microsoft Visual Basic 2008 ISBN: 978-0-470-19134-7 1 June 22nd, 2009 03:56 PM
Inserting Returned Records hugh@kmcnetwork.com SQL Language 2 November 4th, 2003 01:05 PM
Inserting records into a databae aadz5 ASP.NET 1.0 and 1.1 Basics 1 October 19th, 2003 10:47 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.