Click here to Skip to main content
15,909,656 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
how to bind app_data folder's database with crystal reports?
Posted

change the connection string of your dataset to point to local DB file.
something like ..
C#
<add name="FirstConnectionString" connectionstring="Data Source=.\SQLEXPRESS;AttachDbFilename=C:\..\abc.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True" providername="System.Data.SqlClient" />
 
Share this answer
 
1) first of all i have to deattach database from sql server
a) open sql server
b) connect your server
c) open node of database and right click on your database and choose task menu and then choose deattach then database will deattached

2) In second step in visual studio right click on app_data folder and click on add existing item and then select database which you want to add in app_data folder it will be in In my case ( C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS\MSSQL\DATA\accountdb.mdf) and now this database will add in app_data folder

3) Now change your connection string in config file
XML
<connectionstrings>
        <add connectionstring="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Accountdb.mdf;Integrated Security=True;User Instance=True  " name="ConnectionASPX" providername="System.Data.SqlClient" />
</connectionstrings>




//here |DataDirectory| is path of app_data folder and accountdb is the name of database name can be anything of connectionstring.

Thank You if this solution helps you so please vote for me
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900