473,574 Members | 2,686 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 3531
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
5460
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...
2
5125
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...
2
1623
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 ----...
20
2350
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...
8
3204
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
1674
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...
0
5546
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
2905
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...
1
4506
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...
0
7813
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...
0
8249
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...
0
8106
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6461
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5631
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5305
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...
0
3755
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1350
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1066
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.