Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Basics
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 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 May 28th, 2007, 08:53 AM
Registered User
 
Join Date: May 2007
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default Operator '&' is not defined for types 'String'

Hi

I am currently trying to use the INSERT INTO command to insert information entered in TextBoxes into a Database Table named Customers.

I keep getting one particular error in my code that is throwing me a bit, please see the code below that I am using: -

<script runat="server">

    Dim DBConnection As OleDbConnection
    Dim DBCommand As OleDbCommand
    Dim DBReader As OleDbDataReader
    Dim SQLString As String

    Sub CreateButton_Click(Src As Object, Args As CommandEventArgs)

        DBConnection = New OleDbConnection ( _
            ConfigurationSettings.AppSettings("ConnectionStrin g"))
        DBConnection.Open()
        SQLString = "INSERT INTO Customers " & _ "(CustomerName, JoinDate, Address1," & _
            "Address2, County, PostCode, EmailAddress, SiteLogin," & _
            "SitePassword) VALUES (" & _
            "'" & CusName & "', " & _
            "'" & Today & "', " & _
            "'" & Address1 & "', " & _
            "'" & Address2 & "', " & _
            "'" & County & "', " & _
            "'" & Postcode & "', " & _
            "'" & ConfirmEmail & "', " & _
            "'" & UserName & "', " & _
            "'" & ConfirmUserPass & "')"

        dbCommand.ExecuteNonQuery() ' to run command not to expect a result to give slight performance increase.

        dbConnection.Close() ' close the connection.

        If Page.IsValid = True Then
            Status.Text = "Account Created!" ' alert to advise visitor the account created.
            Create.Enabled = False
            ' Create a new user in the database.
        End If

    End Sub

The line that is creating this error is in red, any suggestions of why this is happening?

Thanks
Sharon

 
Old May 28th, 2007, 09:01 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

it thats are object then you forgot the .text property ;)

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 May 28th, 2007, 10:02 AM
Registered User
 
Join Date: May 2007
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi

Thanks for the tip, now have the page working as it should.

Thanks

Sharon






Similar Threads
Thread Thread Starter Forum Replies Last Post
ADODB.Connection user-defined type not defined Wall st Guru Excel VBA 2 March 26th, 2014 03:44 PM
Invalid operator for data type. Operator equals di Pusstiu SQL Server 2000 2 August 10th, 2007 04:51 AM
Appl-defined or Object-defined error 1004 chp Excel VBA 3 April 4th, 2006 08:12 AM
User-defined type not defined (Icecream.mdb) dloren01 BOOK: Beginning Access VBA 0 June 22nd, 2005 10:36 PM
ADO and user-defined data types rgerald SQL Server 2000 3 June 20th, 2005 11:43 AM





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