Wrox Programmer Forums
|
VB Databases Basics Beginning-level VB coding questions specific to using VB with databases. Issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB Databases Basics 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 November 27th, 2007, 07:30 AM
Authorized User
 
Join Date: Nov 2007
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to djobes31770 Send a message via Yahoo to djobes31770
Default Adding records to db

I am new to VB and trying to port my RealBasic mac app over to windows, rb lacks a lot of the tools and interfaces i need for the app. I have a screen that has a few text fields and a datagrid, and im just wanted to get the data added to the the correct table, i have it setup and initializes the db and table, but it does not load the test fields into the db. Here is what i have for testing so far:

Code:
' Create second column.
        column = New DataColumn()
        column.DataType = System.Type.GetType("System.String")
        column.ColumnName = "PackageID"
        column.AutoIncrement = False
        column.Caption = "PackageID"
        column.ReadOnly = False
        column.Unique = False

        ' Add the column to the table.
        table.Columns.Add(column)


        ' Make the ID column the primary key column.
        Dim PrimaryKeyColumns(0) As DataColumn
        PrimaryKeyColumns(0) = table.Columns("id")
        table.PrimaryKey = PrimaryKeyColumns

        ' Create three new DataRow objects and add 
        ' them to the DataTable
        Dim i As Integer
        For i = 0 To 2
            row = table.NewRow()
            row("id") = i
            row("PackageID") = "PackageID " + i.ToString()
            table.Rows.Add(row)
        Next i
Like i said, im new to vb 2005 is what im testing with now, as proof of concept to move forward to the latest versions of the dev tools.

 
Old November 27th, 2007, 08:38 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

I there.. after you do this, are you fetching the data into the database??? with a table.acceptchanges or something like that???

HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
I know that CVS was evil, and now i got the proof:
http://worsethanfailure.com/Articles...-Hate-You.aspx
================================================== =========
 
Old November 27th, 2007, 09:20 AM
Authorized User
 
Join Date: Nov 2007
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to djobes31770 Send a message via Yahoo to djobes31770
Default

No this is all i have, it was all i could find from several referances to add data to db. the beginning vb book.

 
Old November 27th, 2007, 09:27 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

well.. read it again.. you should fetch the data back to the database somewhere.. it's not an automatic process.


HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
I know that CVS was evil, and now i got the proof:
http://worsethanfailure.com/Articles...-Hate-You.aspx
================================================== =========





Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding Records with VBA rohit_ghosh Access VBA 7 June 22nd, 2007 05:05 AM
adding multiple records Vince_421 VB Databases Basics 4 February 28th, 2007 07:22 AM
Adding records to Tables lgpatterson Access VBA 6 March 20th, 2005 07:23 AM
Adding records using form and subform marcin2k Access VBA 3 March 7th, 2005 04:37 PM
adding records sinner Classic ASP Databases 5 February 25th, 2004 06:12 PM





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