WPF/LinqToSql/DataGrid

B

Bill McCormick

Linda said:
Hi Bill,

Thank you for your reply!

But I haven't received your sample until now. Please ensure my email box is
(e-mail address removed).

I sent it again in 2 parts; did you get it now?

Bill
 
B

Bill McCormick

Linda said:
Hi Bill,

Thank you for your reply!

But I haven't received your sample until now. Please ensure my email box is
(e-mail address removed).

I sent it again in 2 parts; did you get it now?

Bill
 
L

Linda Liu[MSFT]

Hi Bill,

Sorry that I still haven't received your email. You may try my another
email box (e-mail address removed).
Or you can tell me your email address, so I can send you an email.

Sincerely,
Linda Liu
Microsoft Online Community Support
 
L

Linda Liu[MSFT]

Hi Bill,

Sorry that I still haven't received your email. You may try my another
email box (e-mail address removed).
Or you can tell me your email address, so I can send you an email.

Sincerely,
Linda Liu
Microsoft Online Community Support
 
Z

Zhi-Xin Ye [MSFT]

Hi Bill,

Thanks for using Microsoft Managed Newsgroup Service, I'm Zhi-Xin Ye.
Linda Liu is on vacation now, I'm her colleague, could you please send the
sample code and database to me and tell me how to reproduce the problem? My
email is (e-mail address removed) and (e-mail address removed).

Best Regards,
Zhi-Xin Ye
Microsoft Managed Newsgroup Support Team

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

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

Zhi-Xin Ye [MSFT]

Hi Bill,

Thanks for using Microsoft Managed Newsgroup Service, I'm Zhi-Xin Ye.
Linda Liu is on vacation now, I'm her colleague, could you please send the
sample code and database to me and tell me how to reproduce the problem? My
email is (e-mail address removed) and (e-mail address removed).

Best Regards,
Zhi-Xin Ye
Microsoft Managed Newsgroup Support Team

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

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

Bill McCormick

Zhi-Xin Ye said:
Hi Bill,

Thanks for using Microsoft Managed Newsgroup Service, I'm Zhi-Xin Ye.
Linda Liu is on vacation now, I'm her colleague, could you please send the
sample code and database to me and tell me how to reproduce the problem? My
email is (e-mail address removed) and (e-mail address removed).

Best Regards,
Zhi-Xin Ye
Microsoft Managed Newsgroup Support Team

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

This posting is provided "AS IS" with no warranties, and confers no rights.
OK. The files are now zipping across the internet :)

Let me know if you don't get them and I'll come up with some way for you
to download them.

Thanks,

Bill
 
B

Bill McCormick

Zhi-Xin Ye said:
Hi Bill,

Thanks for using Microsoft Managed Newsgroup Service, I'm Zhi-Xin Ye.
Linda Liu is on vacation now, I'm her colleague, could you please send the
sample code and database to me and tell me how to reproduce the problem? My
email is (e-mail address removed) and (e-mail address removed).

Best Regards,
Zhi-Xin Ye
Microsoft Managed Newsgroup Support Team

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

This posting is provided "AS IS" with no warranties, and confers no rights.
OK. The files are now zipping across the internet :)

Let me know if you don't get them and I'll come up with some way for you
to download them.

Thanks,

Bill
 
Z

Zhi-Xin Ye [MSFT]

Hi Bill,

I haven't received the sample yet, there might be a problem over the
translation on the network. You can upload the sample on the web for us to
download it. :)

Have a nice day!

Best Regards,
Zhi-Xin Ye
Microsoft Managed Newsgroup Support Team

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

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

Zhi-Xin Ye [MSFT]

Hi Bill,

I haven't received the sample yet, there might be a problem over the
translation on the network. You can upload the sample on the web for us to
download it. :)

Have a nice day!

Best Regards,
Zhi-Xin Ye
Microsoft Managed Newsgroup Support Team

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

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

Bill McCormick

Zhi-Xin Ye said:
Hi Bill,

I haven't received the sample yet, there might be a problem over the
translation on the network. You can upload the sample on the web for us to
download it. :)
Yes, I'm working on that now.

Bill
 
B

Bill McCormick

Zhi-Xin Ye said:
Hi Bill,

I haven't received the sample yet, there might be a problem over the
translation on the network. You can upload the sample on the web for us to
download it. :)
Yes, I'm working on that now.

Bill
 
L

Linda Liu[MSFT]

Hi Bill,

Thank you for your sample project. I have downloaded it on my machine and I
do reproduce the problem when I run the application.

I am performing research on this issue and will get back to you ASAP.

I appreciate your patience!

Sincerely,
Linda Liu
Microsoft Online Community Support
 
L

Linda Liu[MSFT]

Hi Bill,

Thank you for your sample project. I have downloaded it on my machine and I
do reproduce the problem when I run the application.

I am performing research on this issue and will get back to you ASAP.

I appreciate your patience!

Sincerely,
Linda Liu
Microsoft Online Community Support
 
B

Bill McCormick

Linda said:
Hi Bill,

Thank you for your sample project. I have downloaded it on my machine and I
do reproduce the problem when I run the application.

I am performing research on this issue and will get back to you ASAP.

I appreciate your patience!
Awesome!! Thanks so much.
 
B

Bill McCormick

Linda said:
Hi Bill,

Thank you for your sample project. I have downloaded it on my machine and I
do reproduce the problem when I run the application.

I am performing research on this issue and will get back to you ASAP.

I appreciate your patience!
Awesome!! Thanks so much.
 
L

Linda Liu[MSFT]

Hi Bill,

After doing some research on your sample project, I find that it's the data
type of the DspPltSide field in the Dsp database table that causes the
problem. The data type of the DspPltSide field is varchar(1). I modify the
data type to char(1), the problem disappears.

As for how to capture the exception, let's see when the exception occurs.

Run the application and a DataGrid shows with the data retrieved from the
JobOrderTable. When I click a row in the DataGrid, the DataGrid tries to
show the row details. Since the row details contains a DataGrid which is
bound to the Dsps property of the JobOrderTable, LINQ to SQL retrieves the
child records from the Dsp database table corresponding to the specified
parent record in the JobOrderTable. Due to the improper data type of the
DspPltSide field in the Dsp table, the FormatException occurs.

The above behavior of LINQ to SQL is called deferred loading, which means
when you query for an object, you actually retrieve only the object you
requested. The related objects are not automatically fetched at the same
time. You cannot see the fact that the related objects are not already
loaded, because an attempt to access them produces a request that retrieves
them.

Since the data retrieving happens in the main UI thread, we can capture
this FormatException by handling the
Application.DispatcherUnhandledException event. Open the App.xaml file and
add the following attribute to subscribe the DispatcherUnhandledException:

<Application x:Class="ScAggScale.App"

DispatcherUnhandledException="Application_DispatcherUnhandledException"
....>

In the App.xaml.cs file, add the following event handler:

public partial class App:Application
{
private void Application_DispatcherUnhandledException(object sender,
System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
{
MesssageBox.Show("Unhandled Exception:" + e.Exception.Message);
e.Handled = true;
}
}

For more information on handling unhandled exception, please read the
following MSDN document:
http://msdn.microsoft.com/en-us/library/system.windows.application.dispatche
runhandledexception.aspx

Hope this helps.
If you have any question, please feel free to let me know.

Sincerely,
Linda Liu
Microsoft Online Community Support
 
L

Linda Liu[MSFT]

Hi Bill,

After doing some research on your sample project, I find that it's the data
type of the DspPltSide field in the Dsp database table that causes the
problem. The data type of the DspPltSide field is varchar(1). I modify the
data type to char(1), the problem disappears.

As for how to capture the exception, let's see when the exception occurs.

Run the application and a DataGrid shows with the data retrieved from the
JobOrderTable. When I click a row in the DataGrid, the DataGrid tries to
show the row details. Since the row details contains a DataGrid which is
bound to the Dsps property of the JobOrderTable, LINQ to SQL retrieves the
child records from the Dsp database table corresponding to the specified
parent record in the JobOrderTable. Due to the improper data type of the
DspPltSide field in the Dsp table, the FormatException occurs.

The above behavior of LINQ to SQL is called deferred loading, which means
when you query for an object, you actually retrieve only the object you
requested. The related objects are not automatically fetched at the same
time. You cannot see the fact that the related objects are not already
loaded, because an attempt to access them produces a request that retrieves
them.

Since the data retrieving happens in the main UI thread, we can capture
this FormatException by handling the
Application.DispatcherUnhandledException event. Open the App.xaml file and
add the following attribute to subscribe the DispatcherUnhandledException:

<Application x:Class="ScAggScale.App"

DispatcherUnhandledException="Application_DispatcherUnhandledException"
....>

In the App.xaml.cs file, add the following event handler:

public partial class App:Application
{
private void Application_DispatcherUnhandledException(object sender,
System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
{
MesssageBox.Show("Unhandled Exception:" + e.Exception.Message);
e.Handled = true;
}
}

For more information on handling unhandled exception, please read the
following MSDN document:
http://msdn.microsoft.com/en-us/library/system.windows.application.dispatche
runhandledexception.aspx

Hope this helps.
If you have any question, please feel free to let me know.

Sincerely,
Linda Liu
Microsoft Online Community Support
 
B

Bill McCormick

Linda said:
Hi Bill,

After doing some research on your sample project, I find that it's the data
type of the DspPltSide field in the Dsp database table that causes the
problem. The data type of the DspPltSide field is varchar(1). I modify the
data type to char(1), the problem disappears.

Linda,

I'm sorry, but that IS NOT an adequate answer.

First of all, I would think LinqToSql needs to be able to process
VarChar(1) data fields; or is there some reason it should not?

And secondly, most of the Job records link to Dsp records where
DspPltSide is null, so it doesn't make sense that selecting some rows
would cause this exception while most do not.

I'll deal with you answer of how to catch the exception in a separate
thread.


Thanks,


Bill
 
B

Bill McCormick

Linda said:
Hi Bill,

After doing some research on your sample project, I find that it's the data
type of the DspPltSide field in the Dsp database table that causes the
problem. The data type of the DspPltSide field is varchar(1). I modify the
data type to char(1), the problem disappears.

Linda,

I'm sorry, but that IS NOT an adequate answer.

First of all, I would think LinqToSql needs to be able to process
VarChar(1) data fields; or is there some reason it should not?

And secondly, most of the Job records link to Dsp records where
DspPltSide is null, so it doesn't make sense that selecting some rows
would cause this exception while most do not.

I'll deal with you answer of how to catch the exception in a separate
thread.


Thanks,


Bill
 

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