Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB.NET 1.0 > VB.NET 2002/2003 Basics
|
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 12th, 2005, 05:31 AM
Friend of Wrox
 
Join Date: Apr 2005
Posts: 186
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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




 
Old May 12th, 2005, 05:37 AM
Authorized User
 
Join Date: Apr 2005
Posts: 73
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

 
Old May 12th, 2005, 05:44 AM
Friend of Wrox
 
Join Date: Apr 2005
Posts: 186
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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


 
Old May 12th, 2005, 05:52 AM
Authorized User
 
Join Date: Apr 2005
Posts: 73
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

 
Old May 12th, 2005, 05:54 AM
Friend of Wrox
 
Join Date: Apr 2005
Posts: 186
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Wait,

 msgbox("Quote Saved Successfully, QuoteID =" Quote)
 Where is the & ot + before Quote

Prashant


 
Old May 12th, 2005, 05:58 AM
Authorized User
 
Join Date: Apr 2005
Posts: 73
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

 
Old May 12th, 2005, 06:03 AM
Friend of Wrox
 
Join Date: Apr 2005
Posts: 186
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi,


Use -> dbCommand.ExecuteScalar().ToString()

Prashant



 
Old May 12th, 2005, 06:05 AM
Friend of Wrox
 
Join Date: Apr 2005
Posts: 186
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Wait,

Sorry, thats C# not vb style declaration

dim strID as string = dbCommand.ExecuteScalar().ToString

Prashant





 
Old May 12th, 2005, 06:22 AM
Authorized User
 
Join Date: Apr 2005
Posts: 73
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you very much Prashant, that has seemed to cure the problem,
Thank you everyone who has helped me.

D






Similar Threads
Thread Thread Starter Forum Replies Last Post
How to get the LAN ID and insert into database ? kutel ASP.NET 2.0 Professional 1 August 15th, 2007 03:51 AM
Getting Unique ID from Database Nicky_uk Classic ASP Databases 9 January 26th, 2005 04:45 PM
How to Auto Generate ID (Primary Key) SQL Database havering SQL Server ASP 1 December 9th, 2004 05:33 AM
Urgent please help to find Max ID and add 1 to it nhatrang71 Access 5 June 28th, 2004 10:24 PM
open a database depending on session id gtmm9 Classic ASP Databases 1 October 22nd, 2003 01:52 AM





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