Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB.NET 1.0 > VB.NET 2002/2003 Basics
Password Reminder
Register
| FAQ | Members List | 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 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
Reply
 
Thread Tools Search this Thread Display Modes
  #11 (permalink)  
Old May 12th, 2005, 05:31 AM
Friend of Wrox
 
Join Date: Apr 2005
Location: Cochin, , India.
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




Reply With Quote
  #12 (permalink)  
Old May 12th, 2005, 05:37 AM
Authorized User
 
Join Date: Apr 2005
Location: , , .
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

Reply With Quote
  #13 (permalink)  
Old May 12th, 2005, 05:44 AM
Friend of Wrox
 
Join Date: Apr 2005
Location: Cochin, , India.
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


Reply With Quote
  #14 (permalink)  
Old May 12th, 2005, 05:52 AM
Authorized User
 
Join Date: Apr 2005
Location: , , .
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

Reply With Quote
  #15 (permalink)  
Old May 12th, 2005, 05:54 AM
Friend of Wrox
 
Join Date: Apr 2005
Location: Cochin, , India.
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


Reply With Quote
  #16 (permalink)  
Old May 12th, 2005, 05:58 AM
Authorized User
 
Join Date: Apr 2005
Location: , , .
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

Reply With Quote
  #17 (permalink)  
Old May 12th, 2005, 06:03 AM
Friend of Wrox
 
Join Date: Apr 2005
Location: Cochin, , India.
Posts: 186
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi,


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

Prashant



Reply With Quote
  #18 (permalink)  
Old May 12th, 2005, 06:05 AM
Friend of Wrox
 
Join Date: Apr 2005
Location: Cochin, , India.
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





Reply With Quote
  #19 (permalink)  
Old May 12th, 2005, 06:22 AM
Authorized User
 
Join Date: Apr 2005
Location: , , .
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

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

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



All times are GMT -4. The time now is 03:05 PM.


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