RE: FK Constraint Raised for no reason I can find?



Linda,

Thanks, I was most interested in the steps for the second quesiton. i
understand that I must fill the parent table first. If I do not have a
tableadaptor for the parten table on the form how do i add it? Sometimes I
see the table adaptors at the top of my toolbox and then other times they
arn't there? why?

thanks,
Greg P.

"Linda Liu [MSFT]" wrote:

Hi Greg,

Yes, I take charge of the microsoft.public.donet.framework.windowsforms
queue at present. If you have any questions in this field, please don't
hesitate to post in this queue and I will do my best to help you.

As for your first question, since it is about SQL Server, I think you'd
better post it in the microsoft.public.sqlserver queue next time.

By default, the constraints won't be copied to the destination database.
But you could modify the sql statement for creating the table in the
destination database to include the constraints during the import operation.

The steps are probably below.
1. Open SQL Server Management Studio. Unfold the Databases node and find
the database you want to import to.

2. Right-click the database, let's call it DataBase1. Select Tasks, Import
Data from the shortcut menu.

3. Follow the directions of the SQL Server Import and Export Wizard.

a . In the Choose a Data Source step, select the source from which to
copy data, let's call it DataBase2.

b. In the Choose a Destination step, specify where to copy data to.

c. In the Specify Table Copy or Query step, select the Copy data from
one or more tables or views option.

d. In the Select Source Tables and Views step, select the checkboxes
before the tables you want to import, e.g, we select the checkbox before a
table called Table1. Once you select the checkbox before a table, the Edit
button in the same row is enabled.

e. Click the Edit button to open the Column Mappings window. If the
Table1 is a new table to DataBase1, the Edit SQL button is enabled. Click
this button to open the Create Table SQL Statement window. Replace the
default sql statement with a new sql statement which creates the Table1
including the constraints in the SQL statement text box and press the OK
button.

P.S To generate the SQL statement of creating the Table1 including the
constraints, you may go to the DataBase2 and right-click on the Table1.
Select Script Table as, Create To, New Query Edit Window from the shortcut
menu. Then the statement with the contraints is written in a new query edit
window, and you could copy it to sql statement text box in the Create Table
SQL Statement window above.

f. Follow the next directions.

As for your second question, I think you should fill data in the parant
DataTable in the DataSet firstly and fill data into the child DataTable
later.

Hope this helps.
If you have anything unclear, please feel free to let me know.


Sincerely,
Linda Liu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

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


.