473,881 Members | 1,718 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help with first VB application - Data Entry form

Hello all,

This is my first attempt at an application, so kid gloves are
appreciated.

I need to make a very simple form that only has a few elements. One is
TraceCode - a text field that is populated when a user scans a label.
The other is ScanDate - a date/time field that should equal the
date/time of the scan (e.g. 7/31/2006 5:00:00 AM).

When a button is clicked, or Enter is pressed on the keyboard (or as
the last character of the scan), the data should be transmitted to a
SQL table, and the two text field should be cleared and ready for the
next scan.

Currently, I have a simple form, but you have to manually type the
ScanDate. Also, the fields don't clear after the update is successful.

Ideally, there would only be one textbox available to the user, and
when they scan the TraceCode, the ScanDate is automatically populated,
the data is transacted to the SQL table, and the fields clear, ready
for the next scan.

Here is the only code I have, and it is for the "GO" button":

Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click
Dim objConnection As New SqlClient.SqlCo nnection _
("server=.;data base=SafetyStoc k;trusted_conne ction=true")
Dim objCommand As New SqlClient.SqlCo mmand("", objconnection)
Dim objTransaction As SqlClient.SqlTr ansaction, strSQL As
String

Try

objConnection.O pen()
objTransaction = objConnection.B eginTransaction

objCommand.Tran saction = objTransaction

strSQL = "INSERT INTO ActiveSafetySto ck(ScanDate,
TraceCode) " & _
"VALUES('" & txtDatetime.Tex t & "', '" &
txtTraceCode.Te xt & "')"
objCommand.Comm andText = strSQL
objCommand.Exec uteNonQuery()

objTransaction. Commit()
objConnection.C lose()

Catch
Button1.Text = "Failed"
objTransaction. Rollback()
objConnection.C lose()

End Try
End Sub
End Class

Please HELP! :)

Aug 8 '06 #1
17 3558
What, exactly, is your question?
<Ti***********@ gmail.comwrote in message
news:11******** **************@ p79g2000cwp.goo glegroups.com.. .
Hello all,

This is my first attempt at an application, so kid gloves are
appreciated.

I need to make a very simple form that only has a few elements. One is
TraceCode - a text field that is populated when a user scans a label.
The other is ScanDate - a date/time field that should equal the
date/time of the scan (e.g. 7/31/2006 5:00:00 AM).

When a button is clicked, or Enter is pressed on the keyboard (or as
the last character of the scan), the data should be transmitted to a
SQL table, and the two text field should be cleared and ready for the
next scan.

Currently, I have a simple form, but you have to manually type the
ScanDate. Also, the fields don't clear after the update is successful.

Ideally, there would only be one textbox available to the user, and
when they scan the TraceCode, the ScanDate is automatically populated,
the data is transacted to the SQL table, and the fields clear, ready
for the next scan.

Here is the only code I have, and it is for the "GO" button":

Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click
Dim objConnection As New SqlClient.SqlCo nnection _
("server=.;data base=SafetyStoc k;trusted_conne ction=true")
Dim objCommand As New SqlClient.SqlCo mmand("", objconnection)
Dim objTransaction As SqlClient.SqlTr ansaction, strSQL As
String

Try

objConnection.O pen()
objTransaction = objConnection.B eginTransaction

objCommand.Tran saction = objTransaction

strSQL = "INSERT INTO ActiveSafetySto ck(ScanDate,
TraceCode) " & _
"VALUES('" & txtDatetime.Tex t & "', '" &
txtTraceCode.Te xt & "')"
objCommand.Comm andText = strSQL
objCommand.Exec uteNonQuery()

objTransaction. Commit()
objConnection.C lose()

Catch
Button1.Text = "Failed"
objTransaction. Rollback()
objConnection.C lose()

End Try
End Sub
End Class

Please HELP! :)

Aug 8 '06 #2
Sorry,

I need to accomplish the goals listed up top, but I don't know enough
about VB.net to get there. I am hoping someone can tell me how to
modify the given code to accomplish those goals.

Tim

Scott M. wrote:
What, exactly, is your question?
<Ti***********@ gmail.comwrote in message
news:11******** **************@ p79g2000cwp.goo glegroups.com.. .
Hello all,

This is my first attempt at an application, so kid gloves are
appreciated.

I need to make a very simple form that only has a few elements. One is
TraceCode - a text field that is populated when a user scans a label.
The other is ScanDate - a date/time field that should equal the
date/time of the scan (e.g. 7/31/2006 5:00:00 AM).

When a button is clicked, or Enter is pressed on the keyboard (or as
the last character of the scan), the data should be transmitted to a
SQL table, and the two text field should be cleared and ready for the
next scan.

Currently, I have a simple form, but you have to manually type the
ScanDate. Also, the fields don't clear after the update is successful.

Ideally, there would only be one textbox available to the user, and
when they scan the TraceCode, the ScanDate is automatically populated,
the data is transacted to the SQL table, and the fields clear, ready
for the next scan.

Here is the only code I have, and it is for the "GO" button":

Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click
Dim objConnection As New SqlClient.SqlCo nnection _
("server=.;data base=SafetyStoc k;trusted_conne ction=true")
Dim objCommand As New SqlClient.SqlCo mmand("", objconnection)
Dim objTransaction As SqlClient.SqlTr ansaction, strSQL As
String

Try

objConnection.O pen()
objTransaction = objConnection.B eginTransaction

objCommand.Tran saction = objTransaction

strSQL = "INSERT INTO ActiveSafetySto ck(ScanDate,
TraceCode) " & _
"VALUES('" & txtDatetime.Tex t & "', '" &
txtTraceCode.Te xt & "')"
objCommand.Comm andText = strSQL
objCommand.Exec uteNonQuery()

objTransaction. Commit()
objConnection.C lose()

Catch
Button1.Text = "Failed"
objTransaction. Rollback()
objConnection.C lose()

End Try
End Sub
End Class

Please HELP! :)
Aug 8 '06 #3
It sounds like you need some specialized scanning hardware & software, which
is not part of .NET.
<Ti***********@ gmail.comwrote in message
news:11******** **************@ m79g2000cwm.goo glegroups.com.. .
Sorry,

I need to accomplish the goals listed up top, but I don't know enough
about VB.net to get there. I am hoping someone can tell me how to
modify the given code to accomplish those goals.

Tim

Scott M. wrote:
>What, exactly, is your question?
<Ti*********** @gmail.comwrote in message
news:11******* *************** @p79g2000cwp.go oglegroups.com. ..
Hello all,

This is my first attempt at an application, so kid gloves are
appreciated.

I need to make a very simple form that only has a few elements. One is
TraceCode - a text field that is populated when a user scans a label.
The other is ScanDate - a date/time field that should equal the
date/time of the scan (e.g. 7/31/2006 5:00:00 AM).

When a button is clicked, or Enter is pressed on the keyboard (or as
the last character of the scan), the data should be transmitted to a
SQL table, and the two text field should be cleared and ready for the
next scan.

Currently, I have a simple form, but you have to manually type the
ScanDate. Also, the fields don't clear after the update is successful.

Ideally, there would only be one textbox available to the user, and
when they scan the TraceCode, the ScanDate is automatically populated,
the data is transacted to the SQL table, and the fields clear, ready
for the next scan.

Here is the only code I have, and it is for the "GO" button":

Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click
Dim objConnection As New SqlClient.SqlCo nnection _
("server=.;data base=SafetyStoc k;trusted_conne ction=true")
Dim objCommand As New SqlClient.SqlCo mmand("", objconnection)
Dim objTransaction As SqlClient.SqlTr ansaction, strSQL As
String

Try

objConnection.O pen()
objTransaction = objConnection.B eginTransaction

objCommand.Tran saction = objTransaction

strSQL = "INSERT INTO ActiveSafetySto ck(ScanDate,
TraceCode) " & _
"VALUES('" & txtDatetime.Tex t & "', '" &
txtTraceCode.Te xt & "')"
objCommand.Comm andText = strSQL
objCommand.Exec uteNonQuery()

objTransaction. Commit()
objConnection.C lose()

Catch
Button1.Text = "Failed"
objTransaction. Rollback()
objConnection.C lose()

End Try
End Sub
End Class

Please HELP! :)

Aug 8 '06 #4
I don't think so really... all the scanner is doing is speeding up the
data entry. What if I changed it to say:

TraceCode - a textbox that a user types a 12 char string in to
ScanDate - when user presses enter key, a the date/time is captured

When the user hits the enter key, the two fields are transacted to the
SQL server and the two fields are cleared.

The only thing I don't have working is the stupid date/time. I figured
out that I can put a simple txtTraceCode.Te xt = "" to clear the field
after the transaction is completed.

The rest works perfectly given the code below (which was taken, almost
exactly out of Karl Moore's vidual Basic .NET: The Tutorials). All of
the SQL stuff works perfectly.

Thanks!
Tim
Scott M. wrote:
It sounds like you need some specialized scanning hardware & software, which
is not part of .NET.
<Ti***********@ gmail.comwrote in message
news:11******** **************@ m79g2000cwm.goo glegroups.com.. .
Sorry,

I need to accomplish the goals listed up top, but I don't know enough
about VB.net to get there. I am hoping someone can tell me how to
modify the given code to accomplish those goals.

Tim

Scott M. wrote:
What, exactly, is your question?
<Ti***********@ gmail.comwrote in message
news:11******** **************@ p79g2000cwp.goo glegroups.com.. .
Hello all,

This is my first attempt at an application, so kid gloves are
appreciated.

I need to make a very simple form that only has a few elements. One is
TraceCode - a text field that is populated when a user scans a label.
The other is ScanDate - a date/time field that should equal the
date/time of the scan (e.g. 7/31/2006 5:00:00 AM).

When a button is clicked, or Enter is pressed on the keyboard (or as
the last character of the scan), the data should be transmitted to a
SQL table, and the two text field should be cleared and ready for the
next scan.

Currently, I have a simple form, but you have to manually type the
ScanDate. Also, the fields don't clear after the update is successful.

Ideally, there would only be one textbox available to the user, and
when they scan the TraceCode, the ScanDate is automatically populated,
the data is transacted to the SQL table, and the fields clear, ready
for the next scan.

Here is the only code I have, and it is for the "GO" button":

Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click
Dim objConnection As New SqlClient.SqlCo nnection _
("server=.;data base=SafetyStoc k;trusted_conne ction=true")
Dim objCommand As New SqlClient.SqlCo mmand("", objconnection)
Dim objTransaction As SqlClient.SqlTr ansaction, strSQL As
String

Try

objConnection.O pen()
objTransaction = objConnection.B eginTransaction

objCommand.Tran saction = objTransaction

strSQL = "INSERT INTO ActiveSafetySto ck(ScanDate,
TraceCode) " & _
"VALUES('" & txtDatetime.Tex t & "', '" &
txtTraceCode.Te xt & "')"
objCommand.Comm andText = strSQL
objCommand.Exec uteNonQuery()

objTransaction. Commit()
objConnection.C lose()

Catch
Button1.Text = "Failed"
objTransaction. Rollback()
objConnection.C lose()

End Try
End Sub
End Class

Please HELP! :)
Aug 8 '06 #5
Not sure why you want to put the date in the text box when the enter key is
pressed, since you are going to immediatly send it to the database and then
clear it.
Basically you want to do the following:
txtDatetime.Tex t = Now().ToString
Since you said that the scan code is always 12 characters long, you could
put the following in the in the TextChanged event for the scan code:
If txtTraceCode.Te xt.Length = 12 then
txtDatetime.Tex t = Now().ToString
EndIf
--
Terry
"Ti***********@ gmail.com" wrote:
I don't think so really... all the scanner is doing is speeding up the
data entry. What if I changed it to say:

TraceCode - a textbox that a user types a 12 char string in to
ScanDate - when user presses enter key, a the date/time is captured

When the user hits the enter key, the two fields are transacted to the
SQL server and the two fields are cleared.

The only thing I don't have working is the stupid date/time. I figured
out that I can put a simple txtTraceCode.Te xt = "" to clear the field
after the transaction is completed.

The rest works perfectly given the code below (which was taken, almost
exactly out of Karl Moore's vidual Basic .NET: The Tutorials). All of
the SQL stuff works perfectly.

Thanks!
Tim
Scott M. wrote:
It sounds like you need some specialized scanning hardware & software, which
is not part of .NET.
<Ti***********@ gmail.comwrote in message
news:11******** **************@ m79g2000cwm.goo glegroups.com.. .
Sorry,
>
I need to accomplish the goals listed up top, but I don't know enough
about VB.net to get there. I am hoping someone can tell me how to
modify the given code to accomplish those goals.
>
Tim
>
Scott M. wrote:
>What, exactly, is your question?
>>
>>
><Ti*********** @gmail.comwrote in message
>news:11******* *************** @p79g2000cwp.go oglegroups.com. ..
Hello all,
>
This is my first attempt at an application, so kid gloves are
appreciated.
>
I need to make a very simple form that only has a few elements. One is
TraceCode - a text field that is populated when a user scans a label.
The other is ScanDate - a date/time field that should equal the
date/time of the scan (e.g. 7/31/2006 5:00:00 AM).
>
When a button is clicked, or Enter is pressed on the keyboard (or as
the last character of the scan), the data should be transmitted to a
SQL table, and the two text field should be cleared and ready for the
next scan.
>
Currently, I have a simple form, but you have to manually type the
ScanDate. Also, the fields don't clear after the update is successful.
>
Ideally, there would only be one textbox available to the user, and
when they scan the TraceCode, the ScanDate is automatically populated,
the data is transacted to the SQL table, and the fields clear, ready
for the next scan.
>
Here is the only code I have, and it is for the "GO" button":
>
Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click
Dim objConnection As New SqlClient.SqlCo nnection _
("server=.;data base=SafetyStoc k;trusted_conne ction=true")
Dim objCommand As New SqlClient.SqlCo mmand("", objconnection)
Dim objTransaction As SqlClient.SqlTr ansaction, strSQL As
String
>
Try
>
objConnection.O pen()
objTransaction = objConnection.B eginTransaction
>
objCommand.Tran saction = objTransaction
>
strSQL = "INSERT INTO ActiveSafetySto ck(ScanDate,
TraceCode) " & _
"VALUES('" & txtDatetime.Tex t & "', '" &
txtTraceCode.Te xt & "')"
objCommand.Comm andText = strSQL
objCommand.Exec uteNonQuery()
>
objTransaction. Commit()
objConnection.C lose()
>
Catch
Button1.Text = "Failed"
objTransaction. Rollback()
objConnection.C lose()
>
End Try
End Sub
End Class
>
Please HELP! :)
>
>

Aug 8 '06 #6
You simply want the date to populate a textbox when a button is pressed?

Sub Button1_Click() Handles Button1.Click
txtDate.Text = Now.ToShortDate String
End Sub

If you want to clear the textboxes, just set their EnableViewState
properties to False and they will clear automatically after posting to the
server.

<Ti***********@ gmail.comwrote in message
news:11******** *************@p 79g2000cwp.goog legroups.com...
>I don't think so really... all the scanner is doing is speeding up the
data entry. What if I changed it to say:

TraceCode - a textbox that a user types a 12 char string in to
ScanDate - when user presses enter key, a the date/time is captured

When the user hits the enter key, the two fields are transacted to the
SQL server and the two fields are cleared.

The only thing I don't have working is the stupid date/time. I figured
out that I can put a simple txtTraceCode.Te xt = "" to clear the field
after the transaction is completed.

The rest works perfectly given the code below (which was taken, almost
exactly out of Karl Moore's vidual Basic .NET: The Tutorials). All of
the SQL stuff works perfectly.

Thanks!
Tim
Scott M. wrote:
>It sounds like you need some specialized scanning hardware & software,
which
is not part of .NET.
<Ti*********** @gmail.comwrote in message
news:11******* *************** @m79g2000cwm.go oglegroups.com. ..
Sorry,

I need to accomplish the goals listed up top, but I don't know enough
about VB.net to get there. I am hoping someone can tell me how to
modify the given code to accomplish those goals.

Tim

Scott M. wrote:
What, exactly, is your question?
<Ti*********** @gmail.comwrote in message
news:11******* *************** @p79g2000cwp.go oglegroups.com. ..
Hello all,

This is my first attempt at an application, so kid gloves are
appreciated.

I need to make a very simple form that only has a few elements. One
is
TraceCode - a text field that is populated when a user scans a
label.
The other is ScanDate - a date/time field that should equal the
date/time of the scan (e.g. 7/31/2006 5:00:00 AM).

When a button is clicked, or Enter is pressed on the keyboard (or as
the last character of the scan), the data should be transmitted to a
SQL table, and the two text field should be cleared and ready for
the
next scan.

Currently, I have a simple form, but you have to manually type the
ScanDate. Also, the fields don't clear after the update is
successful.

Ideally, there would only be one textbox available to the user, and
when they scan the TraceCode, the ScanDate is automatically
populated,
the data is transacted to the SQL table, and the fields clear, ready
for the next scan.

Here is the only code I have, and it is for the "GO" button":

Private Sub Button1_Click(B yVal sender As System.Object, ByVal e
As
System.EventArg s) Handles Button1.Click
Dim objConnection As New SqlClient.SqlCo nnection _
("server=.;data base=SafetyStoc k;trusted_conne ction=true")
Dim objCommand As New SqlClient.SqlCo mmand("", objconnection)
Dim objTransaction As SqlClient.SqlTr ansaction, strSQL As
String

Try

objConnection.O pen()
objTransaction = objConnection.B eginTransaction

objCommand.Tran saction = objTransaction

strSQL = "INSERT INTO ActiveSafetySto ck(ScanDate,
TraceCode) " & _
"VALUES('" & txtDatetime.Tex t & "', '" &
txtTraceCode.Te xt & "')"
objCommand.Comm andText = strSQL
objCommand.Exec uteNonQuery()

objTransaction. Commit()
objConnection.C lose()

Catch
Button1.Text = "Failed"
objTransaction. Rollback()
objConnection.C lose()

End Try
End Sub
End Class

Please HELP! :)


Aug 8 '06 #7
Timothy,

I assume that your date on the database is in DateTime format.

To set a datetime string as you get it to a DateTime that are four commands
(they are internally almost all the same), in sequence of easy to use are
that

dim mydate as datetime = CDate(scannedDa te)
http://msdn2.microsoft.com/en-us/library/2dt118h2.aspx

,, = Convert.ToDateT ime(scannedDate )
http://msdn2.microsoft.com/en-us/library/2dt118h2.aspx

,, = DateTime.Parse( overloaded)
http://msdn2.microsoft.com/en-us/library/ms289484.aspx

,, = DateTime.ParseE xact(overloaded )
http://msdn.microsoft.com/library/de...exacttopic.asp

Have a look at those, although I assume that the first one will directly
work fine for you.

And don't forget to use parameters
http://www.vb-tips.com/dbpages.aspx?...6-7139b8970071

I hope this helps,

Cor

<Ti***********@ gmail.comschree f in bericht
news:11******** **************@ p79g2000cwp.goo glegroups.com.. .
Hello all,

This is my first attempt at an application, so kid gloves are
appreciated.

I need to make a very simple form that only has a few elements. One is
TraceCode - a text field that is populated when a user scans a label.
The other is ScanDate - a date/time field that should equal the
date/time of the scan (e.g. 7/31/2006 5:00:00 AM).

When a button is clicked, or Enter is pressed on the keyboard (or as
the last character of the scan), the data should be transmitted to a
SQL table, and the two text field should be cleared and ready for the
next scan.

Currently, I have a simple form, but you have to manually type the
ScanDate. Also, the fields don't clear after the update is successful.

Ideally, there would only be one textbox available to the user, and
when they scan the TraceCode, the ScanDate is automatically populated,
the data is transacted to the SQL table, and the fields clear, ready
for the next scan.

Here is the only code I have, and it is for the "GO" button":

Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click
Dim objConnection As New SqlClient.SqlCo nnection _
("server=.;data base=SafetyStoc k;trusted_conne ction=true")
Dim objCommand As New SqlClient.SqlCo mmand("", objconnection)
Dim objTransaction As SqlClient.SqlTr ansaction, strSQL As
String

Try

objConnection.O pen()
objTransaction = objConnection.B eginTransaction

objCommand.Tran saction = objTransaction

strSQL = "INSERT INTO ActiveSafetySto ck(ScanDate,
TraceCode) " & _
"VALUES('" & txtDatetime.Tex t & "', '" &
txtTraceCode.Te xt & "')"
objCommand.Comm andText = strSQL
objCommand.Exec uteNonQuery()

objTransaction. Commit()
objConnection.C lose()

Catch
Button1.Text = "Failed"
objTransaction. Rollback()
objConnection.C lose()

End Try
End Sub
End Class

Please HELP! :)

Aug 9 '06 #8

Comment...

Getting the Date / Time from the 'client' machine can lead to 'false' date /
time stamping...ie the user has messed with the system clock and so on ...
If this time will be used for control / report purposes, I would recommend
either ...

a. Have the database fill the datetime stamp with a default obtained from
the server ...

b. Create a function to get the current date / time from the server or a
common source.

Question - What do you considered the 'Time Stamp' for the scan ... when
item is scanned or when the record is saved ... if scanned, you will need to
get the date from a common source ... if saved, set the default value in the
data table to get the current date time on the server and only issue an
insert with the text field... and let the server fill the date/time stamp.

Jeff.

PS:

b: - Get a data from a common place...

Assuming MSSQL Server Database...
SELECT GetDate();
using a ExecuteScaler on an OLEDBConnection ...

Using MSAccess...
SELECT Now();
using a ExecuteScaler on an OLEDBConnection .


<Ti***********@ gmail.comwrote in message
news:11******** **************@ p79g2000cwp.goo glegroups.com.. .
Hello all,

This is my first attempt at an application, so kid gloves are
appreciated.

I need to make a very simple form that only has a few elements. One is
TraceCode - a text field that is populated when a user scans a label.
The other is ScanDate - a date/time field that should equal the
date/time of the scan (e.g. 7/31/2006 5:00:00 AM).

When a button is clicked, or Enter is pressed on the keyboard (or as
the last character of the scan), the data should be transmitted to a
SQL table, and the two text field should be cleared and ready for the
next scan.

Currently, I have a simple form, but you have to manually type the
ScanDate. Also, the fields don't clear after the update is successful.

Ideally, there would only be one textbox available to the user, and
when they scan the TraceCode, the ScanDate is automatically populated,
the data is transacted to the SQL table, and the fields clear, ready
for the next scan.

Here is the only code I have, and it is for the "GO" button":

Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click
Dim objConnection As New SqlClient.SqlCo nnection _
("server=.;data base=SafetyStoc k;trusted_conne ction=true")
Dim objCommand As New SqlClient.SqlCo mmand("", objconnection)
Dim objTransaction As SqlClient.SqlTr ansaction, strSQL As
String

Try

objConnection.O pen()
objTransaction = objConnection.B eginTransaction

objCommand.Tran saction = objTransaction

strSQL = "INSERT INTO ActiveSafetySto ck(ScanDate,
TraceCode) " & _
"VALUES('" & txtDatetime.Tex t & "', '" &
txtTraceCode.Te xt & "')"
objCommand.Comm andText = strSQL
objCommand.Exec uteNonQuery()

objTransaction. Commit()
objConnection.C lose()

Catch
Button1.Text = "Failed"
objTransaction. Rollback()
objConnection.C lose()

End Try
End Sub
End Class

Please HELP! :)

Aug 9 '06 #9
Hold on Jeff. What if the client, web server and database are in diffeent
time zones? I don't think anyone suggested using the client for the date,
but I think the server should generate that, not the database.


"jeff" <jhersey at allnorth dottt comwrote in message
news:ez******** ******@TK2MSFTN GP05.phx.gbl...
>
Comment...

Getting the Date / Time from the 'client' machine can lead to 'false' date
/ time stamping...ie the user has messed with the system clock and so on
... If this time will be used for control / report purposes, I would
recommend either ...

a. Have the database fill the datetime stamp with a default obtained from
the server ...

b. Create a function to get the current date / time from the server or a
common source.

Question - What do you considered the 'Time Stamp' for the scan ... when
item is scanned or when the record is saved ... if scanned, you will need
to get the date from a common source ... if saved, set the default value
in the data table to get the current date time on the server and only
issue an insert with the text field... and let the server fill the
date/time stamp.

Jeff.

PS:

b: - Get a data from a common place...

Assuming MSSQL Server Database...
SELECT GetDate();
using a ExecuteScaler on an OLEDBConnection ...

Using MSAccess...
SELECT Now();
using a ExecuteScaler on an OLEDBConnection .


<Ti***********@ gmail.comwrote in message
news:11******** **************@ p79g2000cwp.goo glegroups.com.. .
>Hello all,

This is my first attempt at an application, so kid gloves are
appreciated.

I need to make a very simple form that only has a few elements. One is
TraceCode - a text field that is populated when a user scans a label.
The other is ScanDate - a date/time field that should equal the
date/time of the scan (e.g. 7/31/2006 5:00:00 AM).

When a button is clicked, or Enter is pressed on the keyboard (or as
the last character of the scan), the data should be transmitted to a
SQL table, and the two text field should be cleared and ready for the
next scan.

Currently, I have a simple form, but you have to manually type the
ScanDate. Also, the fields don't clear after the update is successful.

Ideally, there would only be one textbox available to the user, and
when they scan the TraceCode, the ScanDate is automatically populated,
the data is transacted to the SQL table, and the fields clear, ready
for the next scan.

Here is the only code I have, and it is for the "GO" button":

Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventAr gs) Handles Button1.Click
Dim objConnection As New SqlClient.SqlCo nnection _
("server=.;data base=SafetyStoc k;trusted_conne ction=true")
Dim objCommand As New SqlClient.SqlCo mmand("", objconnection)
Dim objTransaction As SqlClient.SqlTr ansaction, strSQL As
String

Try

objConnection.O pen()
objTransaction = objConnection.B eginTransaction

objCommand.Tran saction = objTransaction

strSQL = "INSERT INTO ActiveSafetySto ck(ScanDate,
TraceCode) " & _
"VALUES('" & txtDatetime.Tex t & "', '" &
txtTraceCode.T ext & "')"
objCommand.Comm andText = strSQL
objCommand.Exec uteNonQuery()

objTransaction. Commit()
objConnection.C lose()

Catch
Button1.Text = "Failed"
objTransaction. Rollback()
objConnection.C lose()

End Try
End Sub
End Class

Please HELP! :)


Aug 9 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
5487
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- Hello, I have a very simple problem but cannot seem to figure it out. I have a very simple php script that sends a test email to myself. When I debug it in PHP designer, it works with no problems, I get the test email. If
2
5146
by: Anita C | last post by:
Hi, How do I associate or map a specific column in a datatable to a particular element present in an xml document - to read into a datatable as well as write from the datatable to the xml element? Also, how can I associate all the attributes and their values of a particular element to the Name & Value columns of a datatable - to read into a datatable as well as write from the datatable to the xml element? Any help will be greatly...
2
1636
by: Wayne Wengert | last post by:
This is my first attempt to re-write an old VB6 application that exported a CSV file to a .NET application that exports an XML file with the equivelent data. I have limited understanding of OO programming concepts (am trying to learn) and XML serialization is all new ground for me. Anyway, here is what I am trying to accomplish: Goal ---- We sponsor competitions in ehich various teams compete. An "event" is made up of a set of "shows"....
20
2396
by: Jack Schitt | last post by:
I thought I was starting to get a handle on Access, until I tried doing something useful...now I'm stuck. I have a DB with two tables - to keep it simple I'll say that one is an Employee File (Employees), and the other is an Address File (Addresses) linked by SSN. I've set Addresses as a Lookup Table - If the user starts typing in the SSN it should pull up the Employees records. I'm getting stuck in the Data Entry form. When I type in...
8
3228
by: Steph | last post by:
Hi. I'm very new to MS Access and have been presented with an Access database of contacts by my employer. I am trying to redesign the main form of the database so that a button entitled 'search' may be clicked on by the user and the user can then search all records by postcode. I want to do this to prevent duplicate data entry.
6
1687
by: JOSII | last post by:
Getting a string of boolean value into and out of the registry is no problem. Here's the problem: Although you can place an object into the registry and retreive it, I need to place an ArrayList object with 10 string items into the registry and retreive them later. I tried this: key.SetValue("lstNSXitems", lstNSX.Items) where "lstNSXitems" is the name of the subkey, and lstNSX.Items is the
0
5581
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted ******************************************************** For this teeny job, please refer to: http://feeds.reddit.com/feed/8fu/?o=25
1
2915
by: Andy | last post by:
Hi Gang I need help. I have an ASP application that in a nutshell allows data entry on a main page. The problem is I'll have users that enter some data and save it. Then they'll enter some more data and then leave it for 30 mins, 2 hours or whatever. So when they come back they've lost the session state and when they try to save their data, the application goes to a friendly error page saying they've lost the state.
1
4525
by: BobLewiston | last post by:
I tried to compile a Windows Forms Application in Visual C# 2008 Express with this source code from the CSharpSchool tutorial at Programmer's Heaven:using System; using System.Windows.Forms; using System.Drawing; namespace CSharpSchool { class HelloWinForm { static void Main () { Application.Run (new MyWindow ());
0
9926
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, weíll explore What is ONU, What Is Router, ONU & Routerís main usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
0
9775
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11094
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10715
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10811
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7105
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5780
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5974
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4597
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.