Click here to Skip to main content
15,916,835 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionDatagrids Readonly Access Pin
_mubashir25-Aug-05 20:37
_mubashir25-Aug-05 20:37 
QuestionInput from a device Pin
JJRW25-Aug-05 20:27
JJRW25-Aug-05 20:27 
AnswerRe: Input from a device Pin
Dave Kreskowiak26-Aug-05 1:37
mveDave Kreskowiak26-Aug-05 1:37 
GeneralRe: Input from a device Pin
Anonymous26-Aug-05 4:47
Anonymous26-Aug-05 4:47 
GeneralRe: Input from a device Pin
Dave Kreskowiak26-Aug-05 5:08
mveDave Kreskowiak26-Aug-05 5:08 
GeneralRe: Input from a device Pin
Anonymous29-Aug-05 22:21
Anonymous29-Aug-05 22:21 
GeneralRe: Input from a device Pin
Dave Kreskowiak30-Aug-05 2:35
mveDave Kreskowiak30-Aug-05 2:35 
Questionreturning a single value thru an OleDbCommand Pin
medicenpringles25-Aug-05 17:13
medicenpringles25-Aug-05 17:13 
Hello again,

I need some help with a simple OLEDB query. I need to return one value from an Access database. the code below is a snapshot of what i have so far.


Imports System.Data.OleDb<br />
Public Class Prices<br />
    <br />
    Public Shared ReadOnly Property Price(ByVal Name As String, ByVal Size As String) As Double<br />
        Get<br />
            Dim connString As String = "Data Source=""C:\Documents and Settings\user\" & _<br />
            "My Documents\Visual Studio Projects\Quiznos Register\Assoc. Files\Quiznos.mdb"";" & _<<br />
            "Jet OLEDB:Engine Type=5;" & _<br />
            "Provider=""Microsoft.Jet.OLEDB.4.0"";" & _<br />
            "persist security info=False;"<br />
            Dim conn As New OleDbConnection(connString)<br />
            Dim cmdGetPrice As New OleDbCommand("SELECT Products.Price FROM Products Products WHERE" & _<br />
            "(Products.Name='Classic Italian') AND (Products.Size='Small')", conn)<br />
<br />
            Try<br />
                If conn.State <> ConnectionState.Open Then<br />
                    conn.Open()<br />
                End If<br />
            Catch ex As OleDbException<br />
                MsgBox(ae.Message)<br />
            End Try<br />
<br />
            Select Case Name<br />
                Case "Classic Italian"<br />
                    Select Case Size<br />
                        Case "Small"<br />
                            Price = cmdGetPrice.ExecuteNonQuery    '<----- This is where it gives me the error.<br />
			'other cases for other sizes<br />
                    End Select<br />
            ' other cases<br />
            End Select<br />
            Return Price<br />
<br />
            conn.Close()<br />
<br />
        End Get<br />
    End Property<br />
End Class


at the line "Price = cmdGetPrice.ExecuteNonQuery", i get an InvalidOperationException. what do i need to do to return this single value

thanks ahead of time,
stephen
AnswerRe: returning a single value thru an OleDbCommand Pin
_mubashir26-Aug-05 1:03
_mubashir26-Aug-05 1:03 
QuestionMake a pop up using VB.Net Pin
leoccl8625-Aug-05 15:00
leoccl8625-Aug-05 15:00 
AnswerRe: Make a pop up using VB.Net Pin
Dave Kreskowiak26-Aug-05 1:34
mveDave Kreskowiak26-Aug-05 1:34 
Questionconfiguring IIS to run my app as a specified user Pin
DaveC42691325-Aug-05 11:10
DaveC42691325-Aug-05 11:10 
Questiondisplay data hierarchical in datagrid Pin
Member 145166325-Aug-05 9:47
Member 145166325-Aug-05 9:47 
QuestionCalling DLLs during XP Login Screen Pin
°[Halo]°25-Aug-05 7:42
°[Halo]°25-Aug-05 7:42 
AnswerRe: Calling DLLs during XP Login Screen Pin
Dave Kreskowiak25-Aug-05 9:35
mveDave Kreskowiak25-Aug-05 9:35 
GeneralRe: Calling DLLs during XP Login Screen Pin
°[Halo]°25-Aug-05 11:39
°[Halo]°25-Aug-05 11:39 
GeneralRe: Calling DLLs during XP Login Screen Pin
Dave Kreskowiak25-Aug-05 12:31
mveDave Kreskowiak25-Aug-05 12:31 
QuestionRe: Calling DLLs during XP Login Screen Pin
°[Halo]°29-Aug-05 9:16
°[Halo]°29-Aug-05 9:16 
AnswerRe: Calling DLLs during XP Login Screen Pin
Dave Kreskowiak29-Aug-05 9:48
mveDave Kreskowiak29-Aug-05 9:48 
QuestionClass Pin
ADY00725-Aug-05 6:22
ADY00725-Aug-05 6:22 
AnswerRe: Class Pin
Dave Kreskowiak25-Aug-05 6:30
mveDave Kreskowiak25-Aug-05 6:30 
GeneralRe: Class Pin
ADY00725-Aug-05 6:35
ADY00725-Aug-05 6:35 
GeneralRe: Class Pin
Dave Kreskowiak25-Aug-05 7:05
mveDave Kreskowiak25-Aug-05 7:05 
GeneralRe: Class Pin
ADY00725-Aug-05 8:56
ADY00725-Aug-05 8:56 
GeneralRe: Class Pin
Dave Kreskowiak25-Aug-05 9:45
mveDave Kreskowiak25-Aug-05 9:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.