Re-DataBinding Argument Exception

G

Guest

I have a situation where I am doing the following routine

1.)Loading DataTable with DataAdapter
2.)Binding Controls to DataTable
3.)Closing/Disposing of Connection and DataAdapters
4.)Flushing Database
5.)Reloading DataTable with DataAdapter
6.)Re-Binding Controls

I run into my problem on step 6. If I try to Re-Bind the controls a second
time I get and Error 5 Argument Exception. If I dont try to Re-Bind, the
data is no longer bound to my form. I very clearly have a loaded dataset, but
when I push my record navigation buttons the data never changes. Do I lose
my databindings when I close the Connection? The DataAdapter? And if so, how
do I go about rebinding my form?

Thanks!

Mike
 
I

Ilya Tumanov [MS]

DataSet is not aware you have a connection, so it's irrelevant if it's
closed or not

You would get ArgumentException on attempt to set up incorrect binding.
For example, if you're binding to a property/column called "Foo" but
there's not such property/column, you would get an argument exception.
Perhaps, you've changed the schema of the table or using wrong table to
bind to.

Also, if you're updating the same DataTable controls are bound to, there's
no need to rebind.

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
 
G

Guest

Thanks Ilya-

I bind all the controls on the Form Load event. This works fine. But if I
close all connections and DataAdapters and then repopulate my DataTable my
controls are no longer bound on my form. Thus, I thought I would just rebind
them using the exact same code that I use on the Form Load event (i.e. I know
it isnt a syntax error). That's when I get Error 5 Argument exception, but
I'm pretty sure that it's just telling me those controls are already bound,
although it's not obviously not.

I ended up using Databindings.Clear to clear all the bindings and then
"Re-Bind" them. This not pretty, but it seems to work. It obviously takes a
little bit longer to Re-bind the controls so I would prefer to not do it this
way, so if you or anyone has some other suggestions as to what may be going
on I'm all ears!

Thanks.

Mike


"Ilya Tumanov [MS]" said:
DataSet is not aware you have a connection, so it's irrelevant if it's
closed or not

You would get ArgumentException on attempt to set up incorrect binding.
For example, if you're binding to a property/column called "Foo" but
there's not such property/column, you would get an argument exception.
Perhaps, you've changed the schema of the table or using wrong table to
bind to.

Also, if you're updating the same DataTable controls are bound to, there's
no need to rebind.

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
Thread-Topic: Re-DataBinding Argument Exception
thread-index: AcU60cFKayjYfeB+Tj2X3S/NGq6iog==
X-WBNR-Posting-Host: 24.21.97.212
From: "=?Utf-8?B?TWlrZQ==?=" <[email protected]>
Subject: Re-DataBinding Argument Exception
Date: Wed, 6 Apr 2005 10:55:01 -0700
Lines: 20
Message-ID: <[email protected]>
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
Newsgroups: microsoft.public.dotnet.framework.compactframework
NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.1.29
Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGXA03.phx.gbl
Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.dotnet.framework.compactframework:26424
X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework

I have a situation where I am doing the following routine

1.)Loading DataTable with DataAdapter
2.)Binding Controls to DataTable
3.)Closing/Disposing of Connection and DataAdapters
4.)Flushing Database
5.)Reloading DataTable with DataAdapter
6.)Re-Binding Controls

I run into my problem on step 6. If I try to Re-Bind the controls a second
time I get and Error 5 Argument Exception. If I dont try to Re-Bind, the
data is no longer bound to my form. I very clearly have a loaded dataset, but
when I push my record navigation buttons the data never changes. Do I lose
my databindings when I close the Connection? The DataAdapter? And if so, how
do I go about rebinding my form?

Thanks!

Mike
 
I

Ilya Tumanov [MS]

If you're updating the same instance of the DataTable without changing
schema, you do not need to rebind at all.
If you creating a new instance of the DataTable (as I suspect you do), you
have to remove old bindings and rebind to the new instance.

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
Thread-Topic: Re-DataBinding Argument Exception
thread-index: AcU641xFh3+VA8dLS6a99wy7OVb9Bg==
X-WBNR-Posting-Host: 24.21.97.212
From: "=?Utf-8?B?TWlrZQ==?=" <[email protected]>
References: <[email protected]>
Subject: RE: Re-DataBinding Argument Exception
Date: Wed, 6 Apr 2005 13:01:03 -0700
Lines: 92
Message-ID: <[email protected]>
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
Newsgroups: microsoft.public.dotnet.framework.compactframework
NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.1.29
Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTFEED01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGXA
03.phx.gbl
Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.dotnet.framework.compactframework:26441
X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework

Thanks Ilya-

I bind all the controls on the Form Load event. This works fine. But if I
close all connections and DataAdapters and then repopulate my DataTable my
controls are no longer bound on my form. Thus, I thought I would just rebind
them using the exact same code that I use on the Form Load event (i.e. I know
it isnt a syntax error). That's when I get Error 5 Argument exception, but
I'm pretty sure that it's just telling me those controls are already bound,
although it's not obviously not.

I ended up using Databindings.Clear to clear all the bindings and then
"Re-Bind" them. This not pretty, but it seems to work. It obviously takes a
little bit longer to Re-bind the controls so I would prefer to not do it this
way, so if you or anyone has some other suggestions as to what may be going
on I'm all ears!

Thanks.

Mike


"Ilya Tumanov [MS]" said:
DataSet is not aware you have a connection, so it's irrelevant if it's
closed or not

You would get ArgumentException on attempt to set up incorrect binding.
For example, if you're binding to a property/column called "Foo" but
there's not such property/column, you would get an argument exception.
Perhaps, you've changed the schema of the table or using wrong table to
bind to.

Also, if you're updating the same DataTable controls are bound to, there's
no need to rebind.

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
Thread-Topic: Re-DataBinding Argument Exception
thread-index: AcU60cFKayjYfeB+Tj2X3S/NGq6iog==
X-WBNR-Posting-Host: 24.21.97.212
From: "=?Utf-8?B?TWlrZQ==?=" <[email protected]>
Subject: Re-DataBinding Argument Exception
Date: Wed, 6 Apr 2005 10:55:01 -0700
Lines: 20
Message-ID: <[email protected]>
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
Newsgroups: microsoft.public.dotnet.framework.compactframework
NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.1.29
Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGXA03.phx.gbl
Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.dotnet.framework.compactframework:26424
X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework

I have a situation where I am doing the following routine

1.)Loading DataTable with DataAdapter
2.)Binding Controls to DataTable
3.)Closing/Disposing of Connection and DataAdapters
4.)Flushing Database
5.)Reloading DataTable with DataAdapter
6.)Re-Binding Controls

I run into my problem on step 6. If I try to Re-Bind the controls a second
time I get and Error 5 Argument Exception. If I dont try to Re-Bind, the
data is no longer bound to my form. I very clearly have a loaded
dataset,
but
when I push my record navigation buttons the data never changes. Do
I
lose
my databindings when I close the Connection? The DataAdapter? And if
so,
how
do I go about rebinding my form?

Thanks!

Mike
 
G

Guest

Bingo, that was it. I created a New Instance of the DataTable. That was the
problem. Thanks!

"Ilya Tumanov [MS]" said:
If you're updating the same instance of the DataTable without changing
schema, you do not need to rebind at all.
If you creating a new instance of the DataTable (as I suspect you do), you
have to remove old bindings and rebind to the new instance.

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
Thread-Topic: Re-DataBinding Argument Exception
thread-index: AcU641xFh3+VA8dLS6a99wy7OVb9Bg==
X-WBNR-Posting-Host: 24.21.97.212
From: "=?Utf-8?B?TWlrZQ==?=" <[email protected]>
References: <[email protected]>
Subject: RE: Re-DataBinding Argument Exception
Date: Wed, 6 Apr 2005 13:01:03 -0700
Lines: 92
Message-ID: <[email protected]>
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
Newsgroups: microsoft.public.dotnet.framework.compactframework
NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.1.29
Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTFEED01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGXA
03.phx.gbl
Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.dotnet.framework.compactframework:26441
X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework

Thanks Ilya-

I bind all the controls on the Form Load event. This works fine. But if I
close all connections and DataAdapters and then repopulate my DataTable my
controls are no longer bound on my form. Thus, I thought I would just rebind
them using the exact same code that I use on the Form Load event (i.e. I know
it isnt a syntax error). That's when I get Error 5 Argument exception, but
I'm pretty sure that it's just telling me those controls are already bound,
although it's not obviously not.

I ended up using Databindings.Clear to clear all the bindings and then
"Re-Bind" them. This not pretty, but it seems to work. It obviously takes a
little bit longer to Re-bind the controls so I would prefer to not do it this
way, so if you or anyone has some other suggestions as to what may be going
on I'm all ears!

Thanks.

Mike


"Ilya Tumanov [MS]" said:
DataSet is not aware you have a connection, so it's irrelevant if it's
closed or not

You would get ArgumentException on attempt to set up incorrect binding.
For example, if you're binding to a property/column called "Foo" but
there's not such property/column, you would get an argument exception.
Perhaps, you've changed the schema of the table or using wrong table to
bind to.

Also, if you're updating the same DataTable controls are bound to, there's
no need to rebind.

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
Thread-Topic: Re-DataBinding Argument Exception
thread-index: AcU60cFKayjYfeB+Tj2X3S/NGq6iog==
X-WBNR-Posting-Host: 24.21.97.212
From: "=?Utf-8?B?TWlrZQ==?=" <[email protected]>
Subject: Re-DataBinding Argument Exception
Date: Wed, 6 Apr 2005 10:55:01 -0700
Lines: 20
Message-ID: <[email protected]>
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
Newsgroups: microsoft.public.dotnet.framework.compactframework
NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.1.29
Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGXA03.phx.gbl
Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.compactframework:26424
X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework

I have a situation where I am doing the following routine

1.)Loading DataTable with DataAdapter
2.)Binding Controls to DataTable
3.)Closing/Disposing of Connection and DataAdapters
4.)Flushing Database
5.)Reloading DataTable with DataAdapter
6.)Re-Binding Controls

I run into my problem on step 6. If I try to Re-Bind the controls a
second
time I get and Error 5 Argument Exception. If I dont try to Re-Bind, the
data is no longer bound to my form. I very clearly have a loaded dataset,
but
when I push my record navigation buttons the data never changes. Do I
lose
my databindings when I close the Connection? The DataAdapter? And if so,
how
do I go about rebinding my form?

Thanks!

Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top