PC Review


Reply
Thread Tools Rate Thread

data Adapter

 
 
simon
Guest
Posts: n/a
 
      22nd Mar 2005
I use my functions to create adapter and fill dataSet:

funkcije.createAdapter("c_CPOSkupaj", False, myParams).Fill(ds,
"brezReklam")

If I use this function another time to fill dataSet with other table, I get
an error message, like that the parameter already exists.
The SqlParameter with ParameterName '@datumZ' is already contained by
another SqlParameterCollection

So, I would like to clear parameters:

adapter.SelectCommand.Parameters.Clear()

How can I do that?

I don't have reference to data adapter, because it's created by function.

Does exists something like:

currentActiveAdapter.SelectCommand.Parameters.Clear ?

Thank you,
Simon


 
Reply With Quote
 
 
 
 
OHM \( Terry Burns \)
Guest
Posts: n/a
 
      22nd Mar 2005
Something like this ? .. ?

da.InsertCommand.Parameters.Clear

Terry Burns

http://TrainingOn.net





"simon" <(E-Mail Removed)> wrote in message
news:e$(E-Mail Removed)...
>I use my functions to create adapter and fill dataSet:
>
> funkcije.createAdapter("c_CPOSkupaj", False, myParams).Fill(ds,
> "brezReklam")
>
> If I use this function another time to fill dataSet with other table, I
> get an error message, like that the parameter already exists.
> The SqlParameter with ParameterName '@datumZ' is already contained by
> another SqlParameterCollection
>
> So, I would like to clear parameters:
>
> adapter.SelectCommand.Parameters.Clear()
>
> How can I do that?
>
> I don't have reference to data adapter, because it's created by function.
>
> Does exists something like:
>
> currentActiveAdapter.SelectCommand.Parameters.Clear ?
>
> Thank you,
> Simon
>



 
Reply With Quote
 
simon
Guest
Posts: n/a
 
      23rd Mar 2005
Hi,

I know that I can use da.InsertCommand.Parameters.Clear.

But I use function for insert table into data set because I don't want to reference and create each time data adapter.

Instead of this:

Dim da As SqlDataAdapter
da = createAdapter(sqlStr, False, myParams)
da.Fill(myDataSet, tableName)
da.SelectCommand.Parameters.Clear()
da.Dispose()
da = Nothing

I do everything in one line:

funkcije.createAdapter(sqlStr, False, myParams).Fill(ds,"tableName")

Function createAdapter returns adapter, but after creating adapter and use fill method I can't clear the parameters because I don't have reference to it.

I need something like: currentActiveAdapter.SelectCommand.Parameters.Clear()

I hope you know what I mean.

Thank you,
Simon




"OHM ( Terry Burns )" <(E-Mail Removed)> wrote in message news:%(E-Mail Removed)...
> Something like this ? .. ?
>
> da.InsertCommand.Parameters.Clear
>
> Terry Burns
>
> http://TrainingOn.net
>
>
>
>
>
> "simon" <(E-Mail Removed)> wrote in message
> news:e$(E-Mail Removed)...
>>I use my functions to create adapter and fill dataSet:
>>
>> funkcije.createAdapter("c_CPOSkupaj", False, myParams).Fill(ds,
>> "brezReklam")
>>
>> If I use this function another time to fill dataSet with other table, I
>> get an error message, like that the parameter already exists.
>> The SqlParameter with ParameterName '@datumZ' is already contained by
>> another SqlParameterCollection
>>
>> So, I would like to clear parameters:
>>
>> adapter.SelectCommand.Parameters.Clear()
>>
>> How can I do that?
>>
>> I don't have reference to data adapter, because it's created by function.
>>
>> Does exists something like:
>>
>> currentActiveAdapter.SelectCommand.Parameters.Clear ?
>>
>> Thank you,
>> Simon
>>

>
>

 
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
What are Table Adapter and Data Adapter? =?Utf-8?B?UGV0ZXI=?= Microsoft ADO .NET 2 10th Jul 2007 01:32 AM
Passing parameter for Stored Procedure to Data Adapter/Data Set =?Utf-8?B?Um90Y2l2?= Microsoft ADO .NET 10 27th Sep 2006 05:53 PM
Provider independent data access: creating a data adapter from aconnection Harold Howe Microsoft ADO .NET 0 31st May 2006 10:10 PM
problem with data adapter and data set while inserting and retrieving data aniket_sp Microsoft VB .NET 5 4th Jan 2006 07:10 AM
3rd Tier data not displaying in Data Adapter Preview =?Utf-8?B?V2hpc2t5Um9tZW8=?= Microsoft Dot NET Framework Forms 0 20th Jun 2005 08:49 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:52 PM.