Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Basics
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Display Modes
  #1 (permalink)  
Old May 28th, 2007, 08:53 AM
Registered User
 
Join Date: May 2007
Location: , , .
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

  #2 (permalink)  
Old May 28th, 2007, 09:01 AM
Friend of Wrox
Points: 7,395, Level: 36
Points: 7,395, Level: 36 Points: 7,395, Level: 36 Points: 7,395, Level: 36
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 2,190
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
================================================== =========
  #3 (permalink)  
Old May 28th, 2007, 10:02 AM
Registered User
 
Join Date: May 2007
Location: , , .
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

 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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



All times are GMT -4. The time now is 06:38 PM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.