Wrox Programmer Forums
|
Visual Studio 2008 For discussing Visual Studio 2008. Please post code questions about a specific language (C#, VB, ASP.NET, etc) in the correct language forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Studio 2008 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 September 29th, 2009, 04:42 PM
Authorized User
 
Join Date: Jul 2009
Posts: 30
Thanks: 10
Thanked 0 Times in 0 Posts
Question Add to database

Can I have some help with this code i am trying to add text to a database?
Error 1 Identifier expected.

Code:
Public Class Form1
    Public Sub
        Public dbConn As New OleDbConnection(ConnectionString)
        Public queryString As String = "select * from Info where FirstName ="
        '123' ;"
        Public ds As New DataSet
        Public da As New OleDbDataAdapter(queryString, dbConn)
        Public cb As New OleDbCommandBuilder(da)




        TextBox1.DataBindings.Clear()
        TextBox1.DataBindings.Add("text" "firstName")

    End Sub
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        TextBox1.Text = TextBox1.Text
        'TextBox2.Text = TextBox2.Text

        'MessageBox.Show(TextBox1.Text & " " & TextBox2.Text)
    End Sub
End Class
 
Old October 2nd, 2009, 12:25 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

You have the following lines wrong:
Code:
        Public queryString As String = "select * from Info where FirstName ="
        '123' ;"
You've broken a string literal with an extra quote.
Code:
        TextBox1.DataBindings.Add("text" "firstName")
This line won't compile, there are two string values separated by a space. You are missing a comma.
__________________
-Peter
compiledthoughts.com
twitter/peterlanoie
 
Old October 2nd, 2009, 02:32 PM
Authorized User
 
Join Date: Jul 2009
Posts: 30
Thanks: 10
Thanked 0 Times in 0 Posts
Default Add to database

Thank you for your help with this code

Regards
Headworth





Similar Threads
Thread Thread Starter Forum Replies Last Post
add new datasource doesn't have database option aflores207 Visual C++ 0 August 19th, 2008 03:33 PM
can not add data into database khaink ASP.NET 1.0 and 1.1 Basics 6 January 12th, 2008 11:39 AM
How to add image in database desai Pramod ASP.NET 1.0 and 1.1 Basics 4 December 26th, 2006 07:52 AM
How to add to datagrid without database annsary ASP.NET 1.0 and 1.1 Professional 17 April 3rd, 2006 08:44 PM
ASP to add to Database gilgalbiblewheel Classic ASP Databases 7 September 3rd, 2004 06:43 PM





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