Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB.NET 1.0 > VB.NET 2002/2003 Basics
| Search | Today's Posts | Mark Forums Read
VB.NET 2002/2003 Basics For coders who are new to Visual Basic, working in .NET versions 2002 or 2003 (1.0 and 1.1).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET 2002/2003 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 9th, 2005, 05:18 AM
Authorized User
 
Join Date: Apr 2005
Location: , , .
Posts: 73
Thanks: 0
Thanked 0 Times in 0 Posts
Default Writing to Database - Please Help

Hey, I'm trying to write to a database from a number of user controls such as dropdownlists, radiobuttons and checkboxes, the write procedure occurs on button click, I get the compiler error message BC30203: Identifier expected. It idicates to the write function, as always any help is greatly appreciated.

Compiler Error Message: BC30203: Identifier expected.


Source Error:

Error occurs on line 287

Line 285:
Line 286:
Line 287: Function ServerSpec( ByVal server As String, & _
Line 288: ByVal colour As String, & _
Line 289: ByVal processorSpec As String, & _

Code:
 Function ServerSpec( ByVal server As String, & _
                ByVal colour As String, & _
                ByVal processorSpec As String, & _
                ByVal noCPU As Integer, & _
                ByVal memAmount As Integer, & _
                ByVal memConfig As String, & _
                ByVal hDDSpec As String, & _
                ByVal noHDD As Integer, & _
                ByVal rAID As Boolean, & _
                ByVal rAIDType As String, & _
                ByVal fDD As Boolean, & _
                ByVal opticalDrive As Boolean, & _
                ByVal opDriveType As String, & _
                ByVal tape/DAT As String, & _
                ByVal tape/DATType As String, & _
                ByVal notes As String) As Integer
 
Old May 9th, 2005, 06:09 AM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

It usually isn't necessary to post every bit of code you have (the amount of code you post is inversly proportional to the likelyhood that someone will read it all). What is necessary is to post the information about the error. What line is the error occuring on? Then post only that line as well as lines that are pertinant to that line. If we need more we'll ask.

-Peter
 
Old May 9th, 2005, 09:30 AM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Why the ampersands in your function signature? You've probably seen this:

strMyString = "some stuff" & _
   "and some more stuff"

The ampersand is the concatenation operator, not a char associated with the line wrap, only the _ is needed for the line wrap. Therefore:

Function ServerSpec( ByVal server As String, _
                ByVal colour As String, _
                ByVal processorSpec As String, _
                ...

-Peter
 
Old May 9th, 2005, 10:39 AM
Authorized User
 
Join Date: Apr 2005
Location: , , .
Posts: 73
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'm still getting a compiler error message, on line 300

Compiler Error Message: BC30529: All parameters must be explicitly typed if any are.

Source Error:



Line 298: ByVal opticalDrive As Boolean, _
Line 299: ByVal opDriveType As String, _
Line 300: ByVal tape/DAT As String, _
Line 301: ByVal tape/DATType As String, _
Line 302: ByVal notes As String) As Integer



 
Old May 9th, 2005, 01:04 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

I suspect that the / is not a valid character in a variable name.

-Peter
 
Old May 10th, 2005, 03:49 AM
Authorized User
 
Join Date: Apr 2005
Location: , , .
Posts: 73
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks once again Peter, you have helpped me resolve my problem, however I am still getting a compiler error message for my TextBox.

I'm using Additional.TextBox, where Additional is the name of the textbox, any suggestions? The textbox acts as a memo, take loads of notes if need be.

Compiler Error Message: BC30456: 'TextBox' is not a member of 'System.Web.UI.WebControls.TextBox'.


 
Old May 10th, 2005, 08:34 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , .
Posts: 540
Thanks: 0
Thanked 4 Times in 4 Posts
Default

Are you trying to get the text for "Additional". That should be Additional.Text, not Additional.Textbox.

J
 
Old May 10th, 2005, 08:56 AM
Authorized User
 
Join Date: Apr 2005
Location: , , .
Posts: 73
Thanks: 0
Thanked 0 Times in 0 Posts
Default

That seems to have cured the problem thanks J,
but I have got yet another compiler error, indicating line 378

Compiler Error Message: BC30057: Too many arguments to 'Public Function ServerSpec(server As String, colour As String, processorSpec As String, noCPU As Integer, memAmount As Integer, memConfig As String, hDDSpec As String, rAID As Boolean, rAIDType As String, fDD As Boolean, opticalDrive As Boolean, opDriveType As String, tapeDAT As String, tapeDATType As String, notes As String) As Integer'.

Source Error:



Line 376: DropDownList4.SelectedItem.Value, _
Line 377: DropDownList15.SelectedItem.Value, _
Line 378: Additional.Text)
Line 379: msgbox("Quote Saved Successfully, QuoteID = ")
Line 380: End Sub
 
Old May 10th, 2005, 09:37 AM
Authorized User
 
Join Date: Apr 2005
Location: , , .
Posts: 73
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I think I may have solved it, was trying to pass 15 parameters instead of 16, silly me
:o)

D

 
Old May 10th, 2005, 09:41 AM
Authorized User
 
Join Date: Apr 2005
Location: , , .
Posts: 73
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I haven't solved it just yet, sorry, when I clicked the button I got the following message,

Input string was not in a correct format.

on line 384

Exception Details: System.FormatException: Input string was not in a correct format.

Source Error:


Line 382:
Line 383: Sub Button1_Click(sender As Object, e As EventArgs)
Line 384: ServerSpec( _
Line 385: DropDownList1.SelectedItem.Value, _
Line 386: servercolour.SelectedItem.Value, _







Similar Threads
Thread Thread Starter Forum Replies Last Post
Writing to Database Scripts82 ASP.NET 1.0 and 1.1 Professional 8 September 15th, 2006 07:47 AM
Trouble writing database MDrumm Classic ASP Databases 5 August 4th, 2005 03:27 PM
Writing data to database cdenequolo Classic ASP Databases 2 August 17th, 2004 08:00 PM
writing to a database charliejamesuk MySQL 1 March 25th, 2004 11:10 AM
Writing to an external database scottiegirl MySQL 4 March 2nd, 2004 04:02 PM





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