Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change connection string in DataSet.xsd?

I have build my project in C#, I add DataSet.xsd, and connect him to

Oracle DataBase in my computer - work Excellent !!!!

When I installed on the customer computer (that connect to his Oracle DataBase) -

it crushed.

I need to change the connection string on the DataSet.xsd file - but how to do it ?

Is there any xml file ? Or configuration file ?

Thanks in advance.

like image 509
Gold Avatar asked Feb 10 '10 06:02

Gold


4 Answers

You can also open the Dataset and select the TableAdapter that you want to update, right click and go to properties.

here you will see a "connection" property that you can easily change to settings in your web.config file or enter new connection details.

like image 158
Qwerty.ie Avatar answered Oct 24 '22 05:10

Qwerty.ie


When generating a DataSet with the Wizard you are asked to Create-and-Store a ConnectionString. Take a look in your App.Config

like image 43
Henk Holterman Avatar answered Oct 24 '22 05:10

Henk Holterman


I had similar situation... I'd already created lots of datasets, and they each recorded their own connection string in the code behind. A also manually interacted with database via connectionstring I'd placed in App.config file. So to update all this when deploying to as-yet-unknown server would be pain; yet manually changing all those connectionstrings also put me off. In the end I added a 'test' tableAdapter to the .xsd design page... and created a New connection string - this time specifying it be placed in App.config file. Then by magic... all the tableAdapters now used this one connectionstring - just delete the test object & voila!

like image 7
peter Avatar answered Oct 24 '22 06:10

peter


You can using like my code: Note that DataSet can change connection string by app.config but you can change connection string by TableAdapter like below:

NCKHSV_TTD54TableAdapters.adtReportGiangVienTableAdapter tableAdapter = new 
NCKHSV_TTD54TableAdapters.adtReportGiangVienTableAdapter();//Create a TableAdapter to using.
 tableAdapter.Connection.ConnectionString = strConn;//change ConnectionString to strConn
 tableAdapter.ClearBeforeFill = true;
 tableAdapter.Fill(dataset.adtReportGiangVien);
like image 5
Vũ Văn Quỳnh Avatar answered Oct 24 '22 05:10

Vũ Văn Quỳnh