Thursday, May 10, 2012

[C#] Visual Studio Database woes...

Site is on one domain and I need to remotely connect to an SQL Database.
- In the Server Explorer, connecting to the SQL Database uses Windows Authentication.
- With Windows Authentication on, produces untrusted zone error.
- With it off, produces failed login error.

The fix?
- Connection string format:
"Data Source=<source>;Persist Security Info=False;Initial Catalog=<initial_catalog>;Trusted_Connection=Yes"

- In Web.Config, add
       <identity impersonate="true"/>


Sql Db Type is numeric, but how to express it in C#?
- Use Decimal


How to express VarChar(MAX) in C#?
- SqlDbType.VarChar, -1


No comments:

Post a Comment