Wrox Programmer Forums
|
VS.NET 2002/2003 Discussions about the Visual Studio.NET programming environment, the 2002 (1.0) and 2003 (1.1). ** Please don't post code questions here ** For issues specific to a particular language in .NET, please see the other forum categories.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VS.NET 2002/2003 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 October 10th, 2003, 07:09 AM
Registered User
 
Join Date: Oct 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default problems with my vb.net code


my code overwrites the record entered, when it should be adding the new record. anyone got any suggestions as to where i should rearrange my code?

-----------------------------------------------------

Dim strConn As String = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" & Server.MapPath("/clarks03/newapp/database123.mdb") & ";"
        Dim query As String = "select * from [database]"
        Dim MyConnection As New OleDbConnection(strConn)
        Dim objconn As New OleDb.OleDbConnection(strConn)
        Dim myCmd As New OleDbCommand(query, MyConnection)
        Dim dataset1 As DataSet = New DataSet("database")
        Dim objdataadapter As New OleDb.OleDbDataAdapter(query, MyConnection)



        objdataadapter.Fill(dataset1, "database")
        DataGrid1.DataSource = dataset1
        DataGrid1.DataBind()

        Dim NewRow As DataRow
        NewRow = dataset1.Tables("database").NewRow
        NewRow.Item("student ID") = TextBox1.Text
        dataset1.Tables("database").Rows.Add(NewRow)
        DataGrid1.DataSource = dataset1
        DataGrid1.DataBind()


    End Sub
End Class






Similar Threads
Thread Thread Starter Forum Replies Last Post
[HELP] Problems in Asp.net vb, database nielniel ASP.NET 3.5 Basics 2 July 7th, 2008 05:39 PM
Problems at Using CRViewer for Web-Forms (VB.NET) vblover Crystal Reports 1 August 27th, 2004 10:38 AM
Problems at Using CRViewer for Web-Forms (VB.NET) vblover BOOK: Professional Crystal Reports for VS.NET 0 August 18th, 2004 10:04 AM
Help 'beginning asp.net using vb.net' source code jkmf Wrox Book Feedback 1 January 18th, 2004 08:09 AM
VB.NET Edition code problems Solved charul_shukla BOOK: ASP.NET Website Programming Problem-Design-Solution 5 July 11th, 2003 01:56 AM





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