This is a multi-part message in MIME format.

------=_NextPart_000_0008_01C355D7.007D5810
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

I'm trying to insert a record into an Access database, but am getting =
the error "System.Data.OleDb.OleDbException: Syntax error in INSERT INTO =
statement." I've checked and rechecked the code. I've tried variations, =
like adding .toString after name.text, nothing I'm doing is working. I =
hope someone can see what I'm missing.=20

Thanks for your help!=20
Lynnette=20





Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As =
System.EventArgs) Handles btnAdd.Click

Dim strSQL As String
Dim cnn As New OleDbConnection(Constants.OleDbConnectionString)


strSQL =3D "SELECT * FROM Radios"


Dim objCommand As OleDbCommand =3D New OleDbCommand(strSQL, cnn) =
Dim objDataAdapter As New OleDbDataAdapter()
objDataAdapter.SelectCommand =3D objCommand


Dim objDataSet As New DataSet()
objDataAdapter.Fill(objDataSet, "Radios")

Dim objTable As DataTable
objTable =3D objDataSet.Tables("Radios")


Dim chkM As CheckBox =3D Me.chkMike
Dim updval As String
If chkM.Checked Then
updval =3D "1"
Else
updval =3D "0"
End If

Dim chkC As CheckBox =3D Me.chkCharger
Dim updval2 As String
If chkC.Checked Then
updval2 =3D "1"
Else
updval2 =3D "0"
End If

Dim objDataRow As DataRow
objDataRow =3D objTable.NewRow()
objDataRow("intRIN6Digit") =3D CInt(txtRIN.Text) 'integer =
datatype; Primary key
objDataRow("strAssignment") =3D txtAssignment.Text
objDataRow("strCall") =3D txtCall.Text
objDataRow("strDivision") =3D ddlDiv.SelectedItem.Text
objDataRow("strDistrict-Section") =3D txtSecLoc.Text
objDataRow("strTalkGroup") =3D txtTG.Text
objDataRow("strSerialNumber") =3D txtSerial.Text
objDataRow("strModel") =3D txtModel.Text
objDataRow("bPSMike") =3D CBool(updval)
objDataRow("bIndividualCharger") =3D CBool(updval2)

If Len(Me.txtChargerNo.Text) > 1 Then 'integer =
datatype
objDataRow("intChargerNumber") =3D CInt(txtChargerNo.Text)
Else
objDataRow("intChargerNumber") =3D =
Convert.IsDBNull(txtChargerNo.Text)
End If

objDataRow("strOwner") =3D txtOwner.Text
If Len(Me.txtScan.Text) > 1 Then 'integer =
datatype
objDataRow("intAssetTagNo") =3D CInt(txtScan.Text)
Else
objDataRow("intAssetTagNo") =3D =
Convert.IsDBNull(txtScan.Text)
End If

objDataRow("dtSentForRepair") =3D txtRepair.Text
objDataRow("Count") =3D txtCount.Text

objDataRow("strRemarks") =3D txtRemarks.Text


objTable.Rows.Add(objDataRow)

Dim objCommandBuilder As New OleDbCommandBuilder(objDataAdapter)
objDataAdapter.InsertCommand =3D =
objCommandBuilder.GetInsertCommand()
objDataAdapter.Update(objDataSet, "Radios")

lblConfirm.Text =3D ("The Record has been added.")

txtRIN.Text =3D Nothing
txtAssignment.Text =3D Nothing
txtCall.Text =3D Nothing
txtSecLoc =3D Nothing
txtTG.Text =3D Nothing
txtSerial.Text =3D Nothing
txtModel.Text =3D Nothing
txtChargerNo.Text =3D Nothing
txtOwner.Text =3D Nothing
txtScan.Text =3D Nothing
txtRepair.Text =3D Nothing
txtCount.Text =3D Nothing
txtRemarks.Text =3D Nothing
updval =3D Nothing
updval2 =3D Nothing

strSQL =3D Nothing
objCommandBuilder.Dispose()
objDataSet.Dispose()
objDataAdapter.Dispose()
cnn.Close()

End Sub

------=_NextPart_000_0008_01C355D7.007D5810
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1170" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><SPAN class=3DnormalTextSmall><FONT face=3DArial size=3D2>I'm =
trying to insert a=20
record into an Access database, but am getting the error=20
"System.Data.OleDb.OleDbException: Syntax error in INSERT INTO =
statement." I've=20
checked and rechecked the code. I've tried variations, like adding =
.toString=20
after name.text, nothing I'm doing is working. I hope someone can see =
what I'm=20
missing. <BR><BR>Thanks for your help! <BR>Lynnette =
<BR><BR></FONT><PRE><BR>

<BR>
<FONT face=3DArial size=3D2> Private Sub btnAdd_Click(ByVal sender As =
System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click
<BR>
Dim strSQL As String
Dim cnn As New OleDbConnection(Constants.OleDbConnectionString)
<BR>
<BR>
strSQL =3D "SELECT * FROM Radios"

<BR>
Dim objCommand As OleDbCommand =3D New OleDbCommand(strSQL, =
cnn)<BR> Dim objDataAdapter As New OleDbDataAdapter()
objDataAdapter.SelectCommand =3D objCommand
<BR>
<BR>
Dim objDataSet As New DataSet()
objDataAdapter.Fill(objDataSet, "Radios")
<BR>
Dim objTable As DataTable
objTable =3D objDataSet.Tables("Radios")

<BR>
Dim chkM As CheckBox =3D Me.chkMike
Dim updval As String
If chkM.Checked Then
updval =3D "1"
Else
updval =3D "0"
End If
<BR>
Dim chkC As CheckBox =3D Me.chkCharger
Dim updval2 As String
If chkC.Checked Then
updval2 =3D "1"
Else
updval2 =3D "0"
End If

Dim objDataRow As DataRow
objDataRow =3D objTable.NewRow()
objDataRow("intRIN6Digit") =3D CInt(txtRIN.Text) 'integer =
datatype; Primary key
objDataRow("strAssignment") =3D txtAssignment.Text
objDataRow("strCall") =3D txtCall.Text
objDataRow("strDivision") =3D ddlDiv.SelectedItem.Text
objDataRow("strDistrict-Section") =3D txtSecLoc.Text
objDataRow("strTalkGroup") =3D txtTG.Text
objDataRow("strSerialNumber") =3D txtSerial.Text
objDataRow("strModel") =3D txtModel.Text
objDataRow("bPSMike") =3D CBool(updval)
objDataRow("bIndividualCharger") =3D CBool(updval2)

If Len(Me.txtChargerNo.Text) &gt; 1 Then =
'integer datatype
objDataRow("intChargerNumber") =3D CInt(txtChargerNo.Text)
Else
objDataRow("intChargerNumber") =3D =
Convert.IsDBNull(txtChargerNo.Text)
End If

objDataRow("strOwner") =3D txtOwner.Text
If Len(Me.txtScan.Text) &gt; 1 Then 'integer =
datatype
objDataRow("intAssetTagNo") =3D CInt(txtScan.Text)
Else
objDataRow("intAssetTagNo") =3D =
Convert.IsDBNull(txtScan.Text)
End If

objDataRow("dtSentForRepair") =3D txtRepair.Text
objDataRow("Count") =3D txtCount.Text
<BR>
objDataRow("strRemarks") =3D txtRemarks.Text
<BR>

objTable.Rows.Add(objDataRow)
<BR>
Dim objCommandBuilder As New OleDbCommandBuilder(objDataAdapter)
objDataAdapter.InsertCommand =3D =
objCommandBuilder.GetInsertCommand()
objDataAdapter.Update(objDataSet, "Radios")
<BR>
lblConfirm.Text =3D ("The Record has been added.")
<BR>
txtRIN.Text =3D Nothing
txtAssignment.Text =3D Nothing
txtCall.Text =3D Nothing
txtSecLoc =3D Nothing
txtTG.Text =3D Nothing
txtSerial.Text =3D Nothing
txtModel.Text =3D Nothing
txtChargerNo.Text =3D Nothing
txtOwner.Text =3D Nothing
txtScan.Text =3D Nothing
txtRepair.Text =3D Nothing
txtCount.Text =3D Nothing
txtRemarks.Text =3D Nothing
updval =3D Nothing
updval2 =3D Nothing

strSQL =3D Nothing
objCommandBuilder.Dispose()
objDataSet.Dispose()
objDataAdapter.Dispose()
cnn.Close()

End Sub
</FONT></PRE></SPAN></DIV></BODY></HTML>

------=_NextPart_000_0008_01C355D7.007D5810--

Re: INSERT Syntax Error - Pls Help! by Duppypog

Duppypog
Wed Jul 30 16:56:52 CDT 2003

This is a multi-part message in MIME format.

------=_NextPart_000_0009_01C356C3.F62AD700
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Thanks for your quick response. I ended up changing the fieldnames in =
the database to strCount and strDistrictLocation and that worked.

Thanks for the time about my "clean up" code. I tend to err on doing =
too much.

Thanks again,
lds
"Marina" <zlatkinam@nospam.hotmail.com> wrote in message =
news:u44Sd2fVDHA.2052@TK2MSFTNGP10.phx.gbl...
Looks like you have a "count" column, which is a reserved SQL word.

Try set the QuotePrefix and QuoteSuffix of the commandbuilder object =
to "[" and "]" respectively.

Also, you don't need to set all the object to Nothing, nor do you need =
to call Dispose on any of them. This just clutters code and doesn't =
help. Closing any open connections is sufficient.
"Duppypog" <duppypog@nospam.com> wrote in message =
news:%23FmLIifVDHA.1832@TK2MSFTNGP09.phx.gbl...
I'm trying to insert a record into an Access database, but am =
getting the error "System.Data.OleDb.OleDbException: Syntax error in =
INSERT INTO statement." I've checked and rechecked the code. I've tried =
variations, like adding .toString after name.text, nothing I'm doing is =
working. I hope someone can see what I'm missing.=20

Thanks for your help!=20
Lynnette=20





Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As =
System.EventArgs) Handles btnAdd.Click

Dim strSQL As String
Dim cnn As New OleDbConnection(Constants.OleDbConnectionString)


strSQL =3D "SELECT * FROM Radios"


Dim objCommand As OleDbCommand =3D New OleDbCommand(strSQL, cnn) =
Dim objDataAdapter As New OleDbDataAdapter()
objDataAdapter.SelectCommand =3D objCommand


Dim objDataSet As New DataSet()
objDataAdapter.Fill(objDataSet, "Radios")

Dim objTable As DataTable
objTable =3D objDataSet.Tables("Radios")


Dim chkM As CheckBox =3D Me.chkMike
Dim updval As String
If chkM.Checked Then
updval =3D "1"
Else
updval =3D "0"
End If

Dim chkC As CheckBox =3D Me.chkCharger
Dim updval2 As String
If chkC.Checked Then
updval2 =3D "1"
Else
updval2 =3D "0"
End If

Dim objDataRow As DataRow
objDataRow =3D objTable.NewRow()
objDataRow("intRIN6Digit") =3D CInt(txtRIN.Text) 'integer =
datatype; Primary key
objDataRow("strAssignment") =3D txtAssignment.Text
objDataRow("strCall") =3D txtCall.Text
objDataRow("strDivision") =3D ddlDiv.SelectedItem.Text
objDataRow("strDistrict-Section") =3D txtSecLoc.Text
objDataRow("strTalkGroup") =3D txtTG.Text
objDataRow("strSerialNumber") =3D txtSerial.Text
objDataRow("strModel") =3D txtModel.Text
objDataRow("bPSMike") =3D CBool(updval)
objDataRow("bIndividualCharger") =3D CBool(updval2)

If Len(Me.txtChargerNo.Text) > 1 Then 'integer =
datatype
objDataRow("intChargerNumber") =3D CInt(txtChargerNo.Text)
Else
objDataRow("intChargerNumber") =3D =
Convert.IsDBNull(txtChargerNo.Text)
End If

objDataRow("strOwner") =3D txtOwner.Text
If Len(Me.txtScan.Text) > 1 Then 'integer =
datatype
objDataRow("intAssetTagNo") =3D CInt(txtScan.Text)
Else
objDataRow("intAssetTagNo") =3D =
Convert.IsDBNull(txtScan.Text)
End If

objDataRow("dtSentForRepair") =3D txtRepair.Text
objDataRow("Count") =3D txtCount.Text

objDataRow("strRemarks") =3D txtRemarks.Text


objTable.Rows.Add(objDataRow)

Dim objCommandBuilder As New OleDbCommandBuilder(objDataAdapter)
objDataAdapter.InsertCommand =3D =
objCommandBuilder.GetInsertCommand()
objDataAdapter.Update(objDataSet, "Radios")

lblConfirm.Text =3D ("The Record has been added.")

txtRIN.Text =3D Nothing
txtAssignment.Text =3D Nothing
txtCall.Text =3D Nothing
txtSecLoc =3D Nothing
txtTG.Text =3D Nothing
txtSerial.Text =3D Nothing
txtModel.Text =3D Nothing
txtChargerNo.Text =3D Nothing
txtOwner.Text =3D Nothing
txtScan.Text =3D Nothing
txtRepair.Text =3D Nothing
txtCount.Text =3D Nothing
txtRemarks.Text =3D Nothing
updval =3D Nothing
updval2 =3D Nothing

strSQL =3D Nothing
objCommandBuilder.Dispose()
objDataSet.Dispose()
objDataAdapter.Dispose()
cnn.Close()

End Sub

------=_NextPart_000_0009_01C356C3.F62AD700
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1170" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY style=3D"COLOR: #000000; FONT-FAMILY: " bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Thanks for your quick response.&nbsp; I =
ended up=20
changing the fieldnames in the database to strCount and =
strDistrictLocation and=20
that worked.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Thanks for the time about my "clean up" =
code.&nbsp;=20
I tend to err on doing too much.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Thanks again,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>lds</FONT></DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Marina" &lt;<A=20
=
href=3D"mailto:zlatkinam@nospam.hotmail.com">zlatkinam@nospam.hotmail.com=
</A>&gt;=20
wrote in message <A=20
=
href=3D"news:u44Sd2fVDHA.2052@TK2MSFTNGP10.phx.gbl">news:u44Sd2fVDHA.2052=
@TK2MSFTNGP10.phx.gbl</A>...</DIV>
<DIV><FONT face=3DArial size=3D2>Looks like you have a "count" column, =
which is a=20
reserved SQL word.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Try set the QuotePrefix and =
QuoteSuffix&nbsp;of=20
the commandbuilder object&nbsp; to "[" and "]" =
respectively.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Also, you don't need to set all the =
object to=20
Nothing, nor do you need to call Dispose on any of them.&nbsp; This =
just=20
clutters code and doesn't help.&nbsp; Closing any open connections is=20
sufficient.</FONT></DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Duppypog" &lt;<A=20
href=3D"mailto:duppypog@nospam.com">duppypog@nospam.com</A>&gt; =
wrote in=20
message <A=20
=
href=3D"news:%23FmLIifVDHA.1832@TK2MSFTNGP09.phx.gbl">news:%23FmLIifVDHA.=
1832@TK2MSFTNGP09.phx.gbl</A>...</DIV>
<DIV><SPAN class=3DnormalTextSmall><FONT face=3DArial size=3D2>I'm =
trying to=20
insert a record into an Access database, but am getting the error=20
"System.Data.OleDb.OleDbException: Syntax error in INSERT INTO =
statement."=20
I've checked and rechecked the code. I've tried variations, like =
adding=20
.toString after name.text, nothing I'm doing is working. I hope =
someone can=20
see what I'm missing. <BR><BR>Thanks for your help! <BR>Lynnette=20
<BR><BR></FONT><PRE><BR>

<BR>
<FONT face=3DArial size=3D2> Private Sub btnAdd_Click(ByVal sender As =
System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click
<BR>
Dim strSQL As String
Dim cnn As New OleDbConnection(Constants.OleDbConnectionString)
<BR>
<BR>
strSQL =3D "SELECT * FROM Radios"

<BR>
Dim objCommand As OleDbCommand =3D New OleDbCommand(strSQL, =
cnn)<BR> Dim objDataAdapter As New OleDbDataAdapter()
objDataAdapter.SelectCommand =3D objCommand
<BR>
<BR>
Dim objDataSet As New DataSet()
objDataAdapter.Fill(objDataSet, "Radios")
<BR>
Dim objTable As DataTable
objTable =3D objDataSet.Tables("Radios")

<BR>
Dim chkM As CheckBox =3D Me.chkMike
Dim updval As String
If chkM.Checked Then
updval =3D "1"
Else
updval =3D "0"
End If
<BR>
Dim chkC As CheckBox =3D Me.chkCharger
Dim updval2 As String
If chkC.Checked Then
updval2 =3D "1"
Else
updval2 =3D "0"
End If

Dim objDataRow As DataRow
objDataRow =3D objTable.NewRow()
objDataRow("intRIN6Digit") =3D CInt(txtRIN.Text) 'integer =
datatype; Primary key
objDataRow("strAssignment") =3D txtAssignment.Text
objDataRow("strCall") =3D txtCall.Text
objDataRow("strDivision") =3D ddlDiv.SelectedItem.Text
objDataRow("strDistrict-Section") =3D txtSecLoc.Text
objDataRow("strTalkGroup") =3D txtTG.Text
objDataRow("strSerialNumber") =3D txtSerial.Text
objDataRow("strModel") =3D txtModel.Text
objDataRow("bPSMike") =3D CBool(updval)
objDataRow("bIndividualCharger") =3D CBool(updval2)

If Len(Me.txtChargerNo.Text) &gt; 1 Then =
'integer datatype
objDataRow("intChargerNumber") =3D CInt(txtChargerNo.Text)
Else
objDataRow("intChargerNumber") =3D =
Convert.IsDBNull(txtChargerNo.Text)
End If

objDataRow("strOwner") =3D txtOwner.Text
If Len(Me.txtScan.Text) &gt; 1 Then 'integer =
datatype
objDataRow("intAssetTagNo") =3D CInt(txtScan.Text)
Else
objDataRow("intAssetTagNo") =3D =
Convert.IsDBNull(txtScan.Text)
End If

objDataRow("dtSentForRepair") =3D txtRepair.Text
objDataRow("Count") =3D txtCount.Text
<BR>
objDataRow("strRemarks") =3D txtRemarks.Text
<BR>

objTable.Rows.Add(objDataRow)
<BR>
Dim objCommandBuilder As New OleDbCommandBuilder(objDataAdapter)
objDataAdapter.InsertCommand =3D =
objCommandBuilder.GetInsertCommand()
objDataAdapter.Update(objDataSet, "Radios")
<BR>
lblConfirm.Text =3D ("The Record has been added.")
<BR>
txtRIN.Text =3D Nothing
txtAssignment.Text =3D Nothing
txtCall.Text =3D Nothing
txtSecLoc =3D Nothing
txtTG.Text =3D Nothing
txtSerial.Text =3D Nothing
txtModel.Text =3D Nothing
txtChargerNo.Text =3D Nothing
txtOwner.Text =3D Nothing
txtScan.Text =3D Nothing
txtRepair.Text =3D Nothing
txtCount.Text =3D Nothing
txtRemarks.Text =3D Nothing
updval =3D Nothing
updval2 =3D Nothing

strSQL =3D Nothing
objCommandBuilder.Dispose()
objDataSet.Dispose()
objDataAdapter.Dispose()
cnn.Close()

End Sub
</FONT></PRE></SPAN></DIV></BLOCKQUOTE></BLOCKQUOTE></BODY></HTML>

------=_NextPart_000_0009_01C356C3.F62AD700--


Re: INSERT Syntax Error - Pls Help! by Duppypog

Duppypog
Wed Jul 30 16:57:51 CDT 2003

Thanks for the good advice. I'll check out the web site.
lds

"Michael Lang" <m@l.com> wrote in message
news:%23JRAG6fVDHA.656@tk2msftngp13.phx.gbl...
> Have you checked the CommandText of the Insert Command that is generated
by
> GetInsertCommand()? Don't count on it always being correct. If you
don't
> see what the problem is with it, then paste it here so we can look at it.
>
> Also this is alot of code to do in button click event. You should also
> consider moving the data access code into a separate class, maybe in a
> separate Data access DLL. Even a simple application can benefit from a 3
> tiered approach to a data access application. I have other posts in this
> group talking about this. For instance, see thread "Need advice on
> application Architecture"
>
> You don't even have to write the code yourself. I created an open source
> code generator that comes with some templates for generating three tiers
of
> an application (data - DAL, business -BLL, and UI). You can download the
> source code from:
> https://sourceforge.net/projects/dbobjecter
>
> Michael Lang
>
> "Duppypog" <duppypog@nospam.com> wrote in message
> news:%23FmLIifVDHA.1832@TK2MSFTNGP09.phx.gbl...
> I'm trying to insert a record into an Access database, but am getting the
> error "System.Data.OleDb.OleDbException: Syntax error in INSERT INTO
> statement." I've checked and rechecked the code. I've tried variations,
like
> adding .toString after name.text, nothing I'm doing is working. I hope
> someone can see what I'm missing.
>
> Thanks for your help!
> Lynnette
>
>
>
>
>
> Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles btnAdd.Click
>
> Dim strSQL As String
> Dim cnn As New OleDbConnection(Constants.OleDbConnectionString)
>
>
> strSQL = "SELECT * FROM Radios"
>
>
> Dim objCommand As OleDbCommand = New OleDbCommand(strSQL, cnn)
> Dim objDataAdapter As New OleDbDataAdapter()
> objDataAdapter.SelectCommand = objCommand
>
>
> Dim objDataSet As New DataSet()
> objDataAdapter.Fill(objDataSet, "Radios")
>
> Dim objTable As DataTable
> objTable = objDataSet.Tables("Radios")
>
>
> Dim chkM As CheckBox = Me.chkMike
> Dim updval As String
> If chkM.Checked Then
> updval = "1"
> Else
> updval = "0"
> End If
>
> Dim chkC As CheckBox = Me.chkCharger
> Dim updval2 As String
> If chkC.Checked Then
> updval2 = "1"
> Else
> updval2 = "0"
> End If
>
> Dim objDataRow As DataRow
> objDataRow = objTable.NewRow()
> objDataRow("intRIN6Digit") = CInt(txtRIN.Text) 'integer
> datatype; Primary key
> objDataRow("strAssignment") = txtAssignment.Text
> objDataRow("strCall") = txtCall.Text
> objDataRow("strDivision") = ddlDiv.SelectedItem.Text
> objDataRow("strDistrict-Section") = txtSecLoc.Text
> objDataRow("strTalkGroup") = txtTG.Text
> objDataRow("strSerialNumber") = txtSerial.Text
> objDataRow("strModel") = txtModel.Text
> objDataRow("bPSMike") = CBool(updval)
> objDataRow("bIndividualCharger") = CBool(updval2)
>
> If Len(Me.txtChargerNo.Text) > 1 Then 'integer
> datatype
> objDataRow("intChargerNumber") = CInt(txtChargerNo.Text)
> Else
> objDataRow("intChargerNumber") =
> Convert.IsDBNull(txtChargerNo.Text)
> End If
>
> objDataRow("strOwner") = txtOwner.Text
> If Len(Me.txtScan.Text) > 1 Then 'integer
datatype
> objDataRow("intAssetTagNo") = CInt(txtScan.Text)
> Else
> objDataRow("intAssetTagNo") = Convert.IsDBNull(txtScan.Text)
> End If
>
> objDataRow("dtSentForRepair") = txtRepair.Text
> objDataRow("Count") = txtCount.Text
>
> objDataRow("strRemarks") = txtRemarks.Text
>
>
> objTable.Rows.Add(objDataRow)
>
> Dim objCommandBuilder As New OleDbCommandBuilder(objDataAdapter)
> objDataAdapter.InsertCommand =
objCommandBuilder.GetInsertCommand()
> objDataAdapter.Update(objDataSet, "Radios")
>
> lblConfirm.Text = ("The Record has been added.")
>
> txtRIN.Text = Nothing
> txtAssignment.Text = Nothing
> txtCall.Text = Nothing
> txtSecLoc = Nothing
> txtTG.Text = Nothing
> txtSerial.Text = Nothing
> txtModel.Text = Nothing
> txtChargerNo.Text = Nothing
> txtOwner.Text = Nothing
> txtScan.Text = Nothing
> txtRepair.Text = Nothing
> txtCount.Text = Nothing
> txtRemarks.Text = Nothing
> updval = Nothing
> updval2 = Nothing
>
> strSQL = Nothing
> objCommandBuilder.Dispose()
> objDataSet.Dispose()
> objDataAdapter.Dispose()
> cnn.Close()
>
> End Sub
>
>