Windows Develop Bookmark and Share   
 index > Windows Forms Data Controls and Databinding > Could I modify the command created by aqlcommandbuilder?
 

Could I modify the command created by aqlcommandbuilder?

hi, friends, two questions:

1.Could I modify the command created by aqlcommandbuilder?

I need to modify the commandparameter's size. but the command is created by commandbuilder.

2.Why the commandbuilder created parameter 's size is 0?

I set the selectcommand as "select * from tableA" , there is a varchar(max) column inside the tableA. and I create updatecommand by commandbuilder. But when I check the parameter in the commandbuilder.getupdatecommand, i found that ALL the parameter's size is 0. that makes me have an error reported when I try to update a very big string back to the sql server 2005:

The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Data type 0xA7 an invalid data length or metadata length.

Thank you very much!

yours,

Ivan

ivanchain  Wednesday, August 06, 2008 2:05 AM

Hi Ivanchain,

How’s your problem going on now?

Based on my experience, I’d like to suggest make a check on the following things, see if they help:

1. Have you defined a primary key or a unique column in data table within database? In order to let CommandBuilder generate commands successfully, we must set primary key or unique column to table.

2. To generate INSERT, UPDATE, or DELETE statements automatically, SqlCommandBuilder uses the SelectCommand property to retrieve a required set of metadata automatically. If you change the SelectCommand after the metadata has been retrieved, such as after the first update, you should call the RefreshSchema method to update the metadata.

3. The SqlCommandBuilder also uses the Connection, CommandTimeout, and Transaction properties referenced by the SelectCommand. The user should call RefreshSchema if one or more of these properties are modified, or if the SelectCommand itself is replaced. Otherwise the InsertCommand, UpdateCommand, and DeleteCommand properties retain their previous values.

Please do not hesitate to let me know if there is still question, and if so, further information is appreciated.

Thanks.

Best wishes,

Jun Wang

Jun Wang Tim  Monday, August 11, 2008 8:40 AM

Hi Ivanchain,

How’s your problem going on now?

Based on my experience, I’d like to suggest make a check on the following things, see if they help:

1. Have you defined a primary key or a unique column in data table within database? In order to let CommandBuilder generate commands successfully, we must set primary key or unique column to table.

2. To generate INSERT, UPDATE, or DELETE statements automatically, SqlCommandBuilder uses the SelectCommand property to retrieve a required set of metadata automatically. If you change the SelectCommand after the metadata has been retrieved, such as after the first update, you should call the RefreshSchema method to update the metadata.

3. The SqlCommandBuilder also uses the Connection, CommandTimeout, and Transaction properties referenced by the SelectCommand. The user should call RefreshSchema if one or more of these properties are modified, or if the SelectCommand itself is replaced. Otherwise the InsertCommand, UpdateCommand, and DeleteCommand properties retain their previous values.

Please do not hesitate to let me know if there is still question, and if so, further information is appreciated.

Thanks.

Best wishes,

Jun Wang

Jun Wang Tim  Monday, August 11, 2008 8:40 AM

You can use google to search for other answers

Custom Search

More Threads

• how to autogenerate date
• TextBox.Text update problem after DataBind
• How to Serialize DataGridViewTextColumn using CodeDomSerializer or any other related classes.
• Lower case 'q' keystroke doesn't work inside a Custom Cell of Data Grid View control
• update datagridview to datatable
• Question about accessing an element of the DataGrid object
• Populating ListBox In parts using a BindingSource
• how to change the Apperance of the DataGridView's Column header
• Summary Rows in the DataGrid
• Use of DataGrid to make updates to SQL Server DB