localdb connection string for hosting server in ASP.Net

George616
 
on Nov 23, 2020 02:09 AM
1256 Views

Hello forum,

When hosting a website online with database, what will be the connection string? Because my connection string is:

SqlConnection con = new SqlConnection("Data Source=(LocalDB)\\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\\Dataregister.mdf;Integrated Security=True");

The above connection string is for local DB, how will this connection string be online?

And will the connection string be in the .aspx.cs file (that is code page) or will it be inside the web.config file?

Also, will the command line, SqlDataAdapter and DataSet remain the same as shown below? or will there be changed to something different?

SqlCommand cmd = new SqlCommand();
SqlDataAdapter sda = new SqlDataAdapter();
DataSet ds = new DataSet();

Please I need guidance on this. Thank you

Download FREE API for Word, Excel and PDF in ASP.Net: Download
dharmendr
 
on Nov 23, 2020 02:14 AM

Hi George616,

If your hosting package supports the use of SQL Server, they should provide you with the relevant connection details.

Refer below links.

https://forums.asp.net/t/2013428.aspx?localdb+connection+string+for+host