 |
| 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
|
|
|
|

May 9th, 2005, 05:18 AM
|
|
Authorized User
|
|
Join Date: Apr 2005
Posts: 73
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
|

May 9th, 2005, 06:09 AM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
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
|
|

May 9th, 2005, 09:30 AM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
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
|
|

May 9th, 2005, 10:39 AM
|
|
Authorized User
|
|
Join Date: Apr 2005
Posts: 73
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
|

May 9th, 2005, 01:04 PM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
I suspect that the / is not a valid character in a variable name.
- Peter
|
|

May 10th, 2005, 03:49 AM
|
|
Authorized User
|
|
Join Date: Apr 2005
Posts: 73
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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'.
|
|

May 10th, 2005, 08:34 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 540
Thanks: 0
Thanked 4 Times in 4 Posts
|
|
Are you trying to get the text for "Additional". That should be Additional.Text, not Additional.Textbox.
J
|
|

May 10th, 2005, 08:56 AM
|
|
Authorized User
|
|
Join Date: Apr 2005
Posts: 73
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
|

May 10th, 2005, 09:37 AM
|
|
Authorized User
|
|
Join Date: Apr 2005
Posts: 73
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I think I may have solved it, was trying to pass 15 parameters instead of 16, silly me
:o)
D
|
|

May 10th, 2005, 09:41 AM
|
|
Authorized User
|
|
Join Date: Apr 2005
Posts: 73
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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, _
|
|
 |