 |
| 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 12th, 2005, 05:31 AM
|
|
Friend of Wrox
|
|
Join Date: Apr 2005
Posts: 186
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
hi,
First change the function to (not related to compiler error)
[code]
Function Quote() As string
Dim connectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0; Ole DB Services=-4; Data Source=\\boston.co.uk\"& _
"storage\users\Dhwiren\quote.mdb"
Dim dbConnection As System.Data.IDbConnection = New System.Data.OleDb.OleDbConnection(connectionString )
Dim queryString As String = "SELECT MAX(QuoteID) FROM Quotes "
Dim dbCommand As System.Data.IDbCommand = New System.Data.OleDb.OleDbCommand
dbCommand.CommandText = queryString
dbCommand.Connection = dbConnection
dbConnection.open
string strID = dbCommand.ExecuteScalar()
Return strID
End Function
[\code]
Now remove the parameter while calling the function
Now to the compiler Error :
Remove the line breaks(-) in you code in the area ie, from line 400 and try
You have missed somthing there may be a paranthisis ...
Prashant
|
|

May 12th, 2005, 05:37 AM
|
|
Authorized User
|
|
Join Date: Apr 2005
Posts: 73
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Prashant, I need the line continuation,
the code below executes on button click, (its the write procedure to the DB)
Code:
Sub Button1_Click(sender As Object, e As EventArgs)
ServerSpec( _
(CType(DropDownList1.SelectedItem.Value, String)), _
(CType(servercolour.SelectedItem.Value, String)), _
(CType(DropDownList2.SelectedItem.Value, String)), _
(CType(DropDownList3.SelectedItem.Value, Integer)), _
(CType(MemAmt.SelectedItem.Value, Integer)), _
(CType(MemCfig.SelectedItem.Value, String)), _
(CType(DropDownList5.SelectedItem.Value, String)), _
(CType(DropDownList6.SelectedItem.Value, Integer)), _
(CType(DropDownList7.SelectedItem.Value, String)), _
(CType(raid.SelectedItem.Value, String)), _
(CType(FDD.SelectedItem.Value, String)), _
(CType(DropDownList8.SelectedItem.Value, String)), _
(CType(CDType.SelectedItem.Value, String)), _
(CType(DropDownList4.SelectedItem.Value, String)), _
(CType(DropDownList15.SelectedItem.Value, String)), _
(CType(Additional.Text, String)))
msgbox("Quote Saved Successfully, QuoteID =" Quote)
End Sub
P.S I'm still getting the same Compiler error
Compiler Error Message: BC32017: Comma, ')', or a valid expression continuation expected.
pointing to line 403
|
|

May 12th, 2005, 05:44 AM
|
|
Friend of Wrox
|
|
Join Date: Apr 2005
Posts: 186
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
hi,
Try to assign to some variables and call the function
Only this way you will be able to spot the problem.
Also you can print each value and see...
Prashant
|
|

May 12th, 2005, 05:52 AM
|
|
Authorized User
|
|
Join Date: Apr 2005
Posts: 73
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hey Prashant,
I'm sorry for asking such a trivial question but how would I do that, (I'm still relatively new to VB.NET)
D
|
|

May 12th, 2005, 05:54 AM
|
|
Friend of Wrox
|
|
Join Date: Apr 2005
Posts: 186
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Wait,
msgbox("Quote Saved Successfully, QuoteID =" Quote)
Where is the & ot + before Quote
Prashant
|
|

May 12th, 2005, 05:58 AM
|
|
Authorized User
|
|
Join Date: Apr 2005
Posts: 73
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Sorry Prashant,
I know get the following compiler error,
Compiler Error Message: BC30109: 'String' is a class type, and so is not a valid expression.
Source Error:
Line 496:
Line 497: dbConnection.open
Line 498: string strID = dbCommand.ExecuteScalar()
Line 499:
Line 500: Return strID
Refering to line 498
|
|

May 12th, 2005, 06:03 AM
|
|
Friend of Wrox
|
|
Join Date: Apr 2005
Posts: 186
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
hi,
Use -> dbCommand.ExecuteScalar().ToString()
Prashant
|
|

May 12th, 2005, 06:05 AM
|
|
Friend of Wrox
|
|
Join Date: Apr 2005
Posts: 186
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Wait,
Sorry, thats C# not vb style declaration
dim strID as string = dbCommand.ExecuteScalar().ToString
Prashant
|
|

May 12th, 2005, 06:22 AM
|
|
Authorized User
|
|
Join Date: Apr 2005
Posts: 73
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thank you very much Prashant, that has seemed to cure the problem,
Thank you everyone who has helped me.
D
|
|
 |