PC Review


Reply
Thread Tools Rate Thread

How to add a record to a table?

 
 
Binary Poet
Guest
Posts: n/a
 
      13th Jan 2005
Is there a simple way to simply add a record to a table without needing to
do a query, fill a dataset, add the row, etc....?
I do not want to use the "Insert into tablename......" as shown below...

SQLText="Insert into tablename (.......) value(........)" ect......
OLEConn.Open()
OLECommand.CommandText = SQLText
OLECommand.Connection = OLEConn
OLEDR = OLECommand.ExecuteReader
OLECommand.Dispose()


 
Reply With Quote
 
 
 
 
Marina
Guest
Posts: n/a
 
      13th Jan 2005
You don't need to do a Fill. You would have to create a table with the
appropriate schema, and then either define an Insert command, or use the
commandbuilder, and then call Update on the data adapter.

If you ask me, if this is just for one insert, it will be easier to just run
an insert statement. If you need a more robust, generic way of doing it, you
will need to use the method I described above.

"Binary Poet" <(E-Mail Removed)> wrote in message
news:OJxy0WZ%(E-Mail Removed)...
> Is there a simple way to simply add a record to a table without needing to
> do a query, fill a dataset, add the row, etc....?
> I do not want to use the "Insert into tablename......" as shown below...
>
> SQLText="Insert into tablename (.......) value(........)" ect......
> OLEConn.Open()
> OLECommand.CommandText = SQLText
> OLECommand.Connection = OLEConn
> OLEDR = OLECommand.ExecuteReader
> OLECommand.Dispose()
>
>



 
Reply With Quote
 
William \(Bill\) Vaughn
Guest
Posts: n/a
 
      13th Jan 2005
I'm with Marina. I would certainly use a Command object and build a
Parameters collection to pass in the values. This will automatically deal
with a lot of issues you have not encountered (yet).

hth

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

"Marina" <(E-Mail Removed)> wrote in message
news:%23yebHmZ%(E-Mail Removed)...
> You don't need to do a Fill. You would have to create a table with the
> appropriate schema, and then either define an Insert command, or use the
> commandbuilder, and then call Update on the data adapter.
>
> If you ask me, if this is just for one insert, it will be easier to just
> run
> an insert statement. If you need a more robust, generic way of doing it,
> you
> will need to use the method I described above.
>
> "Binary Poet" <(E-Mail Removed)> wrote in message
> news:OJxy0WZ%(E-Mail Removed)...
>> Is there a simple way to simply add a record to a table without needing
>> to
>> do a query, fill a dataset, add the row, etc....?
>> I do not want to use the "Insert into tablename......" as shown below...
>>
>> SQLText="Insert into tablename (.......) value(........)" ect......
>> OLEConn.Open()
>> OLECommand.CommandText = SQLText
>> OLECommand.Connection = OLEConn
>> OLEDR = OLECommand.ExecuteReader
>> OLECommand.Dispose()
>>
>>

>
>



 
Reply With Quote
 
Binary Poet
Guest
Posts: n/a
 
      13th Jan 2005
Thanks for the reply...

I am trying to build a generic method for just one table.. The problem is I
am storing text for pages that were processed from an OCR engine and I get
alot
of ' and " in the text..... which just create havoc tyring to do inserts....

Any other ideas?



"Marina" <(E-Mail Removed)> wrote in message
news:%23yebHmZ%(E-Mail Removed)...
> You don't need to do a Fill. You would have to create a table with the
> appropriate schema, and then either define an Insert command, or use the
> commandbuilder, and then call Update on the data adapter.
>
> If you ask me, if this is just for one insert, it will be easier to just
> run
> an insert statement. If you need a more robust, generic way of doing it,
> you
> will need to use the method I described above.
>
> "Binary Poet" <(E-Mail Removed)> wrote in message
> news:OJxy0WZ%(E-Mail Removed)...
>> Is there a simple way to simply add a record to a table without needing
>> to
>> do a query, fill a dataset, add the row, etc....?
>> I do not want to use the "Insert into tablename......" as shown below...
>>
>> SQLText="Insert into tablename (.......) value(........)" ect......
>> OLEConn.Open()
>> OLECommand.CommandText = SQLText
>> OLECommand.Connection = OLEConn
>> OLEDR = OLECommand.ExecuteReader
>> OLECommand.Dispose()
>>
>>

>
>



 
Reply With Quote
 
Marina
Guest
Posts: n/a
 
      13th Jan 2005
Well, one way is to replace every single quote in a parameter with 2. That
should eliminate syntax errors, not to mention hacking attempts.

A more robust way though, is when you define your insert command to use
parameter placeholders, and then add parameters with appropriate values.
Taking care of any special characters will all be done for you.

"Binary Poet" <(E-Mail Removed)> wrote in message
news:eszvdtZ%(E-Mail Removed)...
> Thanks for the reply...
>
> I am trying to build a generic method for just one table.. The problem is

I
> am storing text for pages that were processed from an OCR engine and I get
> alot
> of ' and " in the text..... which just create havoc tyring to do

inserts....
>
> Any other ideas?
>
>
>
> "Marina" <(E-Mail Removed)> wrote in message
> news:%23yebHmZ%(E-Mail Removed)...
> > You don't need to do a Fill. You would have to create a table with the
> > appropriate schema, and then either define an Insert command, or use the
> > commandbuilder, and then call Update on the data adapter.
> >
> > If you ask me, if this is just for one insert, it will be easier to just
> > run
> > an insert statement. If you need a more robust, generic way of doing it,
> > you
> > will need to use the method I described above.
> >
> > "Binary Poet" <(E-Mail Removed)> wrote in message
> > news:OJxy0WZ%(E-Mail Removed)...
> >> Is there a simple way to simply add a record to a table without needing
> >> to
> >> do a query, fill a dataset, add the row, etc....?
> >> I do not want to use the "Insert into tablename......" as shown

below...
> >>
> >> SQLText="Insert into tablename (.......) value(........)" ect......
> >> OLEConn.Open()
> >> OLECommand.CommandText = SQLText
> >> OLECommand.Connection = OLEConn
> >> OLEDR = OLECommand.ExecuteReader
> >> OLECommand.Dispose()
> >>
> >>

> >
> >

>
>



 
Reply With Quote
 
Binary Poet
Guest
Posts: n/a
 
      13th Jan 2005
Marina,

If I could bother you to show me a sample or a link to what you are
descibing would help more than I can describe.
I was doing a Replace, but read somewhere that this does not help with
performance much

Private Function ReplaceQuotes(ByVal InputString As String) As String

Dim ResultString As String

ResultString = Replace(InputString, "'", "''")

Return ResultString

End Function



"Marina" <(E-Mail Removed)> wrote in message
news:uIys8yZ%(E-Mail Removed)...
> Well, one way is to replace every single quote in a parameter with 2. That
> should eliminate syntax errors, not to mention hacking attempts.
>
> A more robust way though, is when you define your insert command to use
> parameter placeholders, and then add parameters with appropriate values.
> Taking care of any special characters will all be done for you.
>
> "Binary Poet" <(E-Mail Removed)> wrote in message
> news:eszvdtZ%(E-Mail Removed)...
>> Thanks for the reply...
>>
>> I am trying to build a generic method for just one table.. The problem is

> I
>> am storing text for pages that were processed from an OCR engine and I
>> get
>> alot
>> of ' and " in the text..... which just create havoc tyring to do

> inserts....
>>
>> Any other ideas?
>>
>>
>>
>> "Marina" <(E-Mail Removed)> wrote in message
>> news:%23yebHmZ%(E-Mail Removed)...
>> > You don't need to do a Fill. You would have to create a table with the
>> > appropriate schema, and then either define an Insert command, or use
>> > the
>> > commandbuilder, and then call Update on the data adapter.
>> >
>> > If you ask me, if this is just for one insert, it will be easier to
>> > just
>> > run
>> > an insert statement. If you need a more robust, generic way of doing
>> > it,
>> > you
>> > will need to use the method I described above.
>> >
>> > "Binary Poet" <(E-Mail Removed)> wrote in message
>> > news:OJxy0WZ%(E-Mail Removed)...
>> >> Is there a simple way to simply add a record to a table without
>> >> needing
>> >> to
>> >> do a query, fill a dataset, add the row, etc....?
>> >> I do not want to use the "Insert into tablename......" as shown

> below...
>> >>
>> >> SQLText="Insert into tablename (.......) value(........)" ect......
>> >> OLEConn.Open()
>> >> OLECommand.CommandText = SQLText
>> >> OLECommand.Connection = OLEConn
>> >> OLEDR = OLECommand.ExecuteReader
>> >> OLECommand.Dispose()
>> >>
>> >>
>> >
>> >

>>
>>

>
>



 
Reply With Quote
 
William \(Bill\) Vaughn
Guest
Posts: n/a
 
      14th Jan 2005
Again, Marina is right on. Don't bother with the imbedded quotes yourself.
Let ADO.NET do it for you with a Parameter. This also eliminates (or
reduces) the chance of a SQL injection attack.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

"Marina" <(E-Mail Removed)> wrote in message
news:uIys8yZ%(E-Mail Removed)...
> Well, one way is to replace every single quote in a parameter with 2. That
> should eliminate syntax errors, not to mention hacking attempts.
>
> A more robust way though, is when you define your insert command to use
> parameter placeholders, and then add parameters with appropriate values.
> Taking care of any special characters will all be done for you.
>
> "Binary Poet" <(E-Mail Removed)> wrote in message
> news:eszvdtZ%(E-Mail Removed)...
>> Thanks for the reply...
>>
>> I am trying to build a generic method for just one table.. The problem is

> I
>> am storing text for pages that were processed from an OCR engine and I
>> get
>> alot
>> of ' and " in the text..... which just create havoc tyring to do

> inserts....
>>
>> Any other ideas?
>>
>>
>>
>> "Marina" <(E-Mail Removed)> wrote in message
>> news:%23yebHmZ%(E-Mail Removed)...
>> > You don't need to do a Fill. You would have to create a table with the
>> > appropriate schema, and then either define an Insert command, or use
>> > the
>> > commandbuilder, and then call Update on the data adapter.
>> >
>> > If you ask me, if this is just for one insert, it will be easier to
>> > just
>> > run
>> > an insert statement. If you need a more robust, generic way of doing
>> > it,
>> > you
>> > will need to use the method I described above.
>> >
>> > "Binary Poet" <(E-Mail Removed)> wrote in message
>> > news:OJxy0WZ%(E-Mail Removed)...
>> >> Is there a simple way to simply add a record to a table without
>> >> needing
>> >> to
>> >> do a query, fill a dataset, add the row, etc....?
>> >> I do not want to use the "Insert into tablename......" as shown

> below...
>> >>
>> >> SQLText="Insert into tablename (.......) value(........)" ect......
>> >> OLEConn.Open()
>> >> OLECommand.CommandText = SQLText
>> >> OLECommand.Connection = OLEConn
>> >> OLEDR = OLECommand.ExecuteReader
>> >> OLECommand.Dispose()
>> >>
>> >>
>> >
>> >

>>
>>

>
>



 
Reply With Quote
 
Binary Poet
Guest
Posts: n/a
 
      14th Jan 2005
Can someone point me in the right direction here?

This is what I am trying to do based on your sugestions and what I could
find on the net. It is not working and throughing an error


Dim cmd = New OleDb.OleDbCommand("Insert into DocumentFullText values(" &
DocID & "," & PageNum & ", @OCRTEXT)", OLEConn)

Dim p1 As OleDbParameter = cmd.Parameters.Add("@OCRTEXT",
OleDbType.LongVarChar)

p1.Value = OCRText

OLECommand.Connection = OLEConn

OLEDR = OLECommand.ExecuteReader

OLECommand.Dispose()


The table I am trying to insert into is 3 columns
DocID as Int
PageNumber as int
OCRTextData as varchar




"William (Bill) Vaughn" <(E-Mail Removed)> wrote in message
news:en$AyOd%(E-Mail Removed)...
> Again, Marina is right on. Don't bother with the imbedded quotes yourself.
> Let ADO.NET do it for you with a Parameter. This also eliminates (or
> reduces) the chance of a SQL injection attack.
>
> --
> ____________________________________
> William (Bill) Vaughn
> Author, Mentor, Consultant
> Microsoft MVP
> www.betav.com
> Please reply only to the newsgroup so that others can benefit.
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
> __________________________________
>
> "Marina" <(E-Mail Removed)> wrote in message
> news:uIys8yZ%(E-Mail Removed)...
>> Well, one way is to replace every single quote in a parameter with 2.
>> That
>> should eliminate syntax errors, not to mention hacking attempts.
>>
>> A more robust way though, is when you define your insert command to use
>> parameter placeholders, and then add parameters with appropriate values.
>> Taking care of any special characters will all be done for you.
>>
>> "Binary Poet" <(E-Mail Removed)> wrote in message
>> news:eszvdtZ%(E-Mail Removed)...
>>> Thanks for the reply...
>>>
>>> I am trying to build a generic method for just one table.. The problem
>>> is

>> I
>>> am storing text for pages that were processed from an OCR engine and I
>>> get
>>> alot
>>> of ' and " in the text..... which just create havoc tyring to do

>> inserts....
>>>
>>> Any other ideas?
>>>
>>>
>>>
>>> "Marina" <(E-Mail Removed)> wrote in message
>>> news:%23yebHmZ%(E-Mail Removed)...
>>> > You don't need to do a Fill. You would have to create a table with the
>>> > appropriate schema, and then either define an Insert command, or use
>>> > the
>>> > commandbuilder, and then call Update on the data adapter.
>>> >
>>> > If you ask me, if this is just for one insert, it will be easier to
>>> > just
>>> > run
>>> > an insert statement. If you need a more robust, generic way of doing
>>> > it,
>>> > you
>>> > will need to use the method I described above.
>>> >
>>> > "Binary Poet" <(E-Mail Removed)> wrote in message
>>> > news:OJxy0WZ%(E-Mail Removed)...
>>> >> Is there a simple way to simply add a record to a table without
>>> >> needing
>>> >> to
>>> >> do a query, fill a dataset, add the row, etc....?
>>> >> I do not want to use the "Insert into tablename......" as shown

>> below...
>>> >>
>>> >> SQLText="Insert into tablename (.......) value(........)"
>>> >> ect......
>>> >> OLEConn.Open()
>>> >> OLECommand.CommandText = SQLText
>>> >> OLECommand.Connection = OLEConn
>>> >> OLEDR = OLECommand.ExecuteReader
>>> >> OLECommand.Dispose()
>>> >>
>>> >>
>>> >
>>> >
>>>
>>>

>>
>>

>
>



 
Reply With Quote
 
Marina
Guest
Posts: n/a
 
      14th Jan 2005
When you say 'throwing an error' in a newsgroup, you must say what the error
and the error message are. Otherwise, that information is not very helpful
to the people trying to help you.

To run insert/update/delete statements, use ExecuteNonQuery. ExecuteReader
is meant for queries that return result sets, i.e. SELECT queries.

Also, as long as you are going for parameters, you might want to use
parameters for all your columns, including DocID and PageNum.

"Binary Poet" <(E-Mail Removed)> wrote in message
news:%233S5quj%(E-Mail Removed)...
> Can someone point me in the right direction here?
>
> This is what I am trying to do based on your sugestions and what I could
> find on the net. It is not working and throughing an error
>
>
> Dim cmd = New OleDb.OleDbCommand("Insert into DocumentFullText values(" &
> DocID & "," & PageNum & ", @OCRTEXT)", OLEConn)
>
> Dim p1 As OleDbParameter = cmd.Parameters.Add("@OCRTEXT",
> OleDbType.LongVarChar)
>
> p1.Value = OCRText
>
> OLECommand.Connection = OLEConn
>
> OLEDR = OLECommand.ExecuteReader
>
> OLECommand.Dispose()
>
>
> The table I am trying to insert into is 3 columns
> DocID as Int
> PageNumber as int
> OCRTextData as varchar
>
>
>
>
> "William (Bill) Vaughn" <(E-Mail Removed)> wrote in message
> news:en$AyOd%(E-Mail Removed)...
> > Again, Marina is right on. Don't bother with the imbedded quotes

yourself.
> > Let ADO.NET do it for you with a Parameter. This also eliminates (or
> > reduces) the chance of a SQL injection attack.
> >
> > --
> > ____________________________________
> > William (Bill) Vaughn
> > Author, Mentor, Consultant
> > Microsoft MVP
> > www.betav.com
> > Please reply only to the newsgroup so that others can benefit.
> > This posting is provided "AS IS" with no warranties, and confers no
> > rights.
> > __________________________________
> >
> > "Marina" <(E-Mail Removed)> wrote in message
> > news:uIys8yZ%(E-Mail Removed)...
> >> Well, one way is to replace every single quote in a parameter with 2.
> >> That
> >> should eliminate syntax errors, not to mention hacking attempts.
> >>
> >> A more robust way though, is when you define your insert command to use
> >> parameter placeholders, and then add parameters with appropriate

values.
> >> Taking care of any special characters will all be done for you.
> >>
> >> "Binary Poet" <(E-Mail Removed)> wrote in message
> >> news:eszvdtZ%(E-Mail Removed)...
> >>> Thanks for the reply...
> >>>
> >>> I am trying to build a generic method for just one table.. The problem
> >>> is
> >> I
> >>> am storing text for pages that were processed from an OCR engine and I
> >>> get
> >>> alot
> >>> of ' and " in the text..... which just create havoc tyring to do
> >> inserts....
> >>>
> >>> Any other ideas?
> >>>
> >>>
> >>>
> >>> "Marina" <(E-Mail Removed)> wrote in message
> >>> news:%23yebHmZ%(E-Mail Removed)...
> >>> > You don't need to do a Fill. You would have to create a table with

the
> >>> > appropriate schema, and then either define an Insert command, or use
> >>> > the
> >>> > commandbuilder, and then call Update on the data adapter.
> >>> >
> >>> > If you ask me, if this is just for one insert, it will be easier to
> >>> > just
> >>> > run
> >>> > an insert statement. If you need a more robust, generic way of doing
> >>> > it,
> >>> > you
> >>> > will need to use the method I described above.
> >>> >
> >>> > "Binary Poet" <(E-Mail Removed)> wrote in message
> >>> > news:OJxy0WZ%(E-Mail Removed)...
> >>> >> Is there a simple way to simply add a record to a table without
> >>> >> needing
> >>> >> to
> >>> >> do a query, fill a dataset, add the row, etc....?
> >>> >> I do not want to use the "Insert into tablename......" as shown
> >> below...
> >>> >>
> >>> >> SQLText="Insert into tablename (.......) value(........)"
> >>> >> ect......
> >>> >> OLEConn.Open()
> >>> >> OLECommand.CommandText = SQLText
> >>> >> OLECommand.Connection = OLEConn
> >>> >> OLEDR = OLECommand.ExecuteReader
> >>> >> OLECommand.Dispose()
> >>> >>
> >>> >>
> >>> >
> >>> >
> >>>
> >>>
> >>
> >>

> >
> >

>
>



 
Reply With Quote
 
Binary Poet
Guest
Posts: n/a
 
      14th Jan 2005
Marina,

Good point, sorry about that...
I will add the others as parameters as soon as I can get the basic's
working.....


Here is the updated code that I am trying to execute:

Dim cmd = New OleDb.OleDbCommand("Insert into DocumentFullText values(" &
DocID & "," & PageNum & ",@OCRTEXT)", OLEConn)
With cmd.parameters
.add(New OleDbParameter("@OCRTEXT", OleDb.OleDbType.VarChar))
End With
cmd.parameters("@OCRTEXT").value = OCRText
Try
cmd.executeNonQuery()
Catch ex As Exception
MsgBox(ex.Message)
End Try

The error I get is:
"Exception has been thrown by the target of an invocation"

The stack trace is:

at System.Reflection.RuntimeMethodInfo.InternalInvoke(Object obj,
BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo
culture, Boolean isBinderDefault, Assembly caller, Boolean verifyAccess)

at System.Reflection.RuntimeMethodInfo.InternalInvoke(Object obj,
BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo
culture, Boolean verifyAccess)

at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags
invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)

at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)

at Microsoft.VisualBasic.CompilerServices.LateBinding.FastCall(Object o,
MethodBase method, ParameterInfo[] Parameters, Object[] args, Type objType,
IReflect objIReflect)

at
Microsoft.VisualBasic.CompilerServices.LateBinding.InternalLateCall(Object
o, Type objType, String name, Object[] args, String[] paramnames, Boolean[]
CopyBack, Boolean IgnoreReturn)

at Microsoft.VisualBasic.CompilerServices.LateBinding.LateCall(Object o,
Type objType, String name, Object[] args, String[] paramnames, Boolean[]
CopyBack)

at aXs.OCR.SaveOCRDataForPage(Int64 DocID, Int32 PageNum, String OCRText) in
C:\aXsInfo\Source\aXsNet3.0\aXs\aXsNet.vb:line 251



Many thanks again!

Steve





"Marina" <(E-Mail Removed)> wrote in message
news:u14QiEk%(E-Mail Removed)...
> When you say 'throwing an error' in a newsgroup, you must say what the
> error
> and the error message are. Otherwise, that information is not very helpful
> to the people trying to help you.
>
> To run insert/update/delete statements, use ExecuteNonQuery. ExecuteReader
> is meant for queries that return result sets, i.e. SELECT queries.
>
> Also, as long as you are going for parameters, you might want to use
> parameters for all your columns, including DocID and PageNum.
>
> "Binary Poet" <(E-Mail Removed)> wrote in message
> news:%233S5quj%(E-Mail Removed)...
>> Can someone point me in the right direction here?
>>
>> This is what I am trying to do based on your sugestions and what I could
>> find on the net. It is not working and throughing an error
>>
>>
>> Dim cmd = New OleDb.OleDbCommand("Insert into DocumentFullText values(" &
>> DocID & "," & PageNum & ", @OCRTEXT)", OLEConn)
>>
>> Dim p1 As OleDbParameter = cmd.Parameters.Add("@OCRTEXT",
>> OleDbType.LongVarChar)
>>
>> p1.Value = OCRText
>>
>> OLECommand.Connection = OLEConn
>>
>> OLEDR = OLECommand.ExecuteReader
>>
>> OLECommand.Dispose()
>>
>>
>> The table I am trying to insert into is 3 columns
>> DocID as Int
>> PageNumber as int
>> OCRTextData as varchar
>>
>>
>>
>>
>> "William (Bill) Vaughn" <(E-Mail Removed)> wrote in message
>> news:en$AyOd%(E-Mail Removed)...
>> > Again, Marina is right on. Don't bother with the imbedded quotes

> yourself.
>> > Let ADO.NET do it for you with a Parameter. This also eliminates (or
>> > reduces) the chance of a SQL injection attack.
>> >
>> > --
>> > ____________________________________
>> > William (Bill) Vaughn
>> > Author, Mentor, Consultant
>> > Microsoft MVP
>> > www.betav.com
>> > Please reply only to the newsgroup so that others can benefit.
>> > This posting is provided "AS IS" with no warranties, and confers no
>> > rights.
>> > __________________________________
>> >
>> > "Marina" <(E-Mail Removed)> wrote in message
>> > news:uIys8yZ%(E-Mail Removed)...
>> >> Well, one way is to replace every single quote in a parameter with 2.
>> >> That
>> >> should eliminate syntax errors, not to mention hacking attempts.
>> >>
>> >> A more robust way though, is when you define your insert command to
>> >> use
>> >> parameter placeholders, and then add parameters with appropriate

> values.
>> >> Taking care of any special characters will all be done for you.
>> >>
>> >> "Binary Poet" <(E-Mail Removed)> wrote in message
>> >> news:eszvdtZ%(E-Mail Removed)...
>> >>> Thanks for the reply...
>> >>>
>> >>> I am trying to build a generic method for just one table.. The
>> >>> problem
>> >>> is
>> >> I
>> >>> am storing text for pages that were processed from an OCR engine and
>> >>> I
>> >>> get
>> >>> alot
>> >>> of ' and " in the text..... which just create havoc tyring to do
>> >> inserts....
>> >>>
>> >>> Any other ideas?
>> >>>
>> >>>
>> >>>
>> >>> "Marina" <(E-Mail Removed)> wrote in message
>> >>> news:%23yebHmZ%(E-Mail Removed)...
>> >>> > You don't need to do a Fill. You would have to create a table with

> the
>> >>> > appropriate schema, and then either define an Insert command, or
>> >>> > use
>> >>> > the
>> >>> > commandbuilder, and then call Update on the data adapter.
>> >>> >
>> >>> > If you ask me, if this is just for one insert, it will be easier to
>> >>> > just
>> >>> > run
>> >>> > an insert statement. If you need a more robust, generic way of
>> >>> > doing
>> >>> > it,
>> >>> > you
>> >>> > will need to use the method I described above.
>> >>> >
>> >>> > "Binary Poet" <(E-Mail Removed)> wrote in message
>> >>> > news:OJxy0WZ%(E-Mail Removed)...
>> >>> >> Is there a simple way to simply add a record to a table without
>> >>> >> needing
>> >>> >> to
>> >>> >> do a query, fill a dataset, add the row, etc....?
>> >>> >> I do not want to use the "Insert into tablename......" as shown
>> >> below...
>> >>> >>
>> >>> >> SQLText="Insert into tablename (.......) value(........)"
>> >>> >> ect......
>> >>> >> OLEConn.Open()
>> >>> >> OLECommand.CommandText = SQLText
>> >>> >> OLECommand.Connection = OLEConn
>> >>> >> OLEDR = OLECommand.ExecuteReader
>> >>> >> OLECommand.Dispose()
>> >>> >>
>> >>> >>
>> >>> >
>> >>> >
>> >>>
>> >>>
>> >>
>> >>
>> >
>> >

>>
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Compare two fields each record of table, update record or notin new table John Spencer (MVP) Microsoft Access VBA Modules 0 5th Jan 2009 05:10 PM
How to read a table record by record and process and update another table Karen Middleton Microsoft Access Macros 1 3rd Jan 2005 12:30 PM
How to read a table record by record and process and update another table Karen Middleton Microsoft Access VBA Modules 2 2nd Jan 2005 01:04 PM
How to read a table record by record and process and update another table Karen Middleton Microsoft Access Macros 1 31st Dec 2004 12:40 PM
How to read a table record by record and process and update another table Karen Middleton Microsoft Access Queries 1 31st Dec 2004 12:40 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:20 PM.