THANK YOU!!! I knew there was a way, but just didn't get the syntax correct. It works great and you saved me.:-D
spettiford
Posts
-
Can you pass a local variable into sql statement? -
Can you pass a local variable into sql statement?I’m trying to access one row in a table based upon its int value held locally in a variable. (I increment the 'count' variable in the application.) As you can see below, 'count' is the local variable in the application. Can this be done or is there another way? -Shannon If count < iResultQuery Then myConn_.CommandText = "SELECT WorkInstructions.InstructionText FROM WorkInstructions WHERE WorkInstructions.StepNo = count" end if :confused:
-
Capturing data via hyperterminalI'm scanning a barcode and viewing the data on hyperterminal. I'm wondering if there is anyway the data on hyperterminal can captured dynamically using vb.net?
-
SQL Server QuestionCan a tuple within a table hold a URL that points to a particular file, so that when a SELECT is made on that tuple it will open up the file itself?
-
Need suggestions on using a barcode scanner as a input deviceThere is no keyboard input. The user is using a industry barcode scanner to vehicle parts. The scanner is th only input device. Any ideas? Shannon
-
Need suggestions on using a barcode scanner as a input deviceI'm attempting to tackle a problem I have no experience with. Does anyone know a good resource where that I can use to be able to interface with a barcode scanner in order to navigate a application. (The application I'm creating has mouse or keyboard input devices, only a barcode reader. It will ONLY allow a user to scan an object and progress/navigate throughout the application by means of a barcode reader.) Any ideas? :confused: shannon
-
Validating textbox value against a dbFound the solution! My EmpId should have been my table name. Stupid syntax error on my part! Thanks to all. Shannon P.
-
Validating textbox value against a dbMy problem begins at "myCommand.ExecuteScalar()". My try...catch error handler reads, "Invalid object name: EmpId". My table has a column labeled "EmpId" so I'm not actually sure what the problem is. Any ideas?:) Shannon P. Dim myConnection As New System.Data.SqlClient.SqlConnection myConnection.ConnectionString = "workstation id=SHANNON-OUYIJ2M;packet size=4096;integrated security=SSPI;data source=SHANNON-OUYIJ2M;persist security info=False;initial catalog=WorkInstructionLibrary" 'Create a parameterised command that will return the number of matches. Dim myCommand As New SqlCommand("SELECT COUNT(*) FROM EmpID WHERE EmpID = @employeeId", myConnection) 'Set the parameter values to the credentials entered by the user. myCommand.Parameters.Add("@employeeId", SqlDbType.Int).Value = Me.txtEmpId.Text myConnection.Open() Try Dim count As Integer count = CInt(myCommand.ExecuteScalar()) If count = 0 Then 'generic fail message Else 'allow application to proceed End If Catch ex As SqlException Dim errorMessages As String Dim i As Integer For i = 0 To ex.Errors.Count - 1 errorMessages += "Index #" & i.ToString() & ControlChars.NewLine _ & "Message: " & ex.Errors(i).Message & ControlChars.NewLine _ & "LineNumber: " & ex.Errors(i).LineNumber & ControlChars.NewLine _ & "Source: " & ex.Errors(i).Source & ControlChars.NewLine _ & "Procedure: " & ex.Errors(i).Procedure & ControlChars.NewLine Next i Dim log As System.Diagnostics.EventLog = New System.Diagnostics.EventLog log.Source = "My Application" log.WriteEntry(errorMessages) Console.WriteLine("An exception occurred. Please contact your system administrator.") MessageBox.Show("Error: EXECUTESCALAR METHOD" & errorMessages.ToString & " <> " & ex.ToString, "Error executing EXECUTESCALAR METHOD", MessageBoxButtons.OK) End Try
-
Validating textbox value against a dbWhat I'm attempting to do is to validate what a user's id is within a textbox with what is stored within the sql server database. If the id on the textbox matches what is inside the database, begin the application. If not, display an error message to user. That is what I'm attempting to do. Any ideas would be greatly appreciated. Shannon P.
-
Validating textbox value against a dbI have a textbox where a user enters his/her id number. After a click event, I want to take that id number and compare it to the id that is stored on my sql server database table, then allow the user to either proceed or stop. Any ideas how to do that? Shannon P.
-
Updating/Writing to SQL ServerI have a form that has multiple textboxes that a user needs to input data into in order to write to several tables within sql server. All of the controls on the form are data binded to a column within a specific table. I can read from all tables using the (generic) code command: DataAdapter.Fill(DataSet) My problem is that I can not update/write to the database. I'm using the (generic) code command: DataAdapter.Update(DataSet), so that when any change is made to any textbox control when the user triggers the click event button to update the database it will update/write to the database using what is currently in the textboxes. I receive no error messages and my 'CommandText' property under the dataAdapter has the sql code generated to insert a into the proper fields and tables. Any idea(s) why I can not update/write to the sql server? Language: vb.net 2003 Server: sql server 2000 Shannon P.