Click here to Skip to main content
15,901,284 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionSending a filename to a Fortran app Pin
matt_hirst17-May-07 9:25
matt_hirst17-May-07 9:25 
AnswerRe: Sending a filename to a Fortran app Pin
Dave Kreskowiak17-May-07 11:09
mveDave Kreskowiak17-May-07 11:09 
GeneralRe: Sending a filename to a Fortran app Pin
matt_hirst20-May-07 2:32
matt_hirst20-May-07 2:32 
GeneralRe: Sending a filename to a Fortran app Pin
Dave Kreskowiak20-May-07 4:42
mveDave Kreskowiak20-May-07 4:42 
QuestionCondition Property Syntax Pin
Karma3125117-May-07 9:25
Karma3125117-May-07 9:25 
QuestionService deployment question? Pin
tcombs0717-May-07 8:53
tcombs0717-May-07 8:53 
AnswerRe: Service deployment question? Pin
Joseph Guadagno17-May-07 10:15
Joseph Guadagno17-May-07 10:15 
QuestionLooking for existing data... Pin
CCG317-May-07 7:35
CCG317-May-07 7:35 
Hello, I am trying to look in a table to see if the item already exisits before I add another one. I have a simple table with 2 fields. The primary key is one and it is an auto number, the other is the description that I am trying to check for.

The name of my table is OrdersListBoxInfo and the table name I am trying to compare with is Order. Once I get to the line "Count = cmd.ExecuteScalar" I am getting error "No value given for one or more required parameters."

Here's the code I am running. Can anyone tell me what I am missing/doing wrong?

Dim OrderName As String
OrderName = txtOrderName.Text


'Check to see if this Order already exisits

Dim Count As Integer = 0
Using Connection As New OleDbConnection _
("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\Costco\My Documents\Visual Studio Projects\AnesXL.mdb")

Dim cmd As OleDbCommand = New OleDbCommand _
("Select Count( OrderName ) as ExistingRecords From [OrdersListBoxInfo] where [Order]=?", _
Connection)
cmd.Parameters.AddWithValue("@Order", OrderName)

Connection.Open()
Count = cmd.ExecuteScalar

End Using

If Count > 0 Then
MessageBox.Show("Number of rows found: " & Count, "Add Date", MessageBoxButtons.OK)
Return
End If

AnswerRe: Looking for existing data... Pin
Dave Kreskowiak17-May-07 7:55
mveDave Kreskowiak17-May-07 7:55 
Questionshell return value Pin
tj2817-May-07 4:50
tj2817-May-07 4:50 
AnswerRe: shell return value Pin
Dave Kreskowiak17-May-07 5:05
mveDave Kreskowiak17-May-07 5:05 
AnswerRe: shell return value Pin
tj2817-May-07 5:24
tj2817-May-07 5:24 
GeneralRe: shell return value Pin
Dave Kreskowiak17-May-07 5:29
mveDave Kreskowiak17-May-07 5:29 
QuestionBackground image in VB.net Pin
Brizee17-May-07 4:25
Brizee17-May-07 4:25 
AnswerRe: Background image in VB.net Pin
Dave Kreskowiak17-May-07 5:38
mveDave Kreskowiak17-May-07 5:38 
GeneralRe: Background image in VB.net Pin
Brizee17-May-07 5:57
Brizee17-May-07 5:57 
GeneralRe: Background image in VB.net Pin
Dave Kreskowiak17-May-07 6:16
mveDave Kreskowiak17-May-07 6:16 
GeneralRe: Background image in VB.net Pin
Brizee17-May-07 12:49
Brizee17-May-07 12:49 
GeneralRe: Background image in VB.net Pin
Dave Kreskowiak17-May-07 15:21
mveDave Kreskowiak17-May-07 15:21 
GeneralRe: Background image in VB.net Pin
Brizee17-May-07 22:27
Brizee17-May-07 22:27 
GeneralRe: Background image in VB.net Pin
Dave Kreskowiak18-May-07 12:47
mveDave Kreskowiak18-May-07 12:47 
QuestionEnumChildWindows Pin
Knoen17-May-07 3:33
Knoen17-May-07 3:33 
AnswerRe: EnumChildWindows Pin
Duncan Edwards Jones17-May-07 4:07
professionalDuncan Edwards Jones17-May-07 4:07 
GeneralRe: EnumChildWindows Pin
Knoen17-May-07 4:18
Knoen17-May-07 4:18 
QuestionCountdown Timer Pin
Brizee17-May-07 3:01
Brizee17-May-07 3:01 

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.