Showing posts with label line. Show all posts
Showing posts with label line. Show all posts

Wednesday, March 7, 2012

how initialize a connection string in .Net

i am using a control that i downloaded from the control gallery It has a line for a connection string.

which i put on in there:

data source=server;initial catalog=database;user id=blahblah;password=557896
and i get an error:

Exception Details: System.InvalidOperationException: The ConnectionString property has not been initialized.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[InvalidOperationException: The ConnectionString property has not been initialized.]
System.Data.SqlClient.SqlConnection.Open() +433
Microsoft.Vote.VoteButtonClick(Object sender, EventArgs e) +289
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1277

How would i initialize the connection string.

any help would be appreciated

aluckeHi,
normally we would have initialized the connection by doing this

dim conn as new sqlconnection("data source=server;initial catalog=database;user id=blahblah;password=557896")

if you still experience error can you print out your codes too?

Sunday, February 19, 2012

How grant all objects

How
grant user to tables(insert,update,delete,select),Sp,Func,Views !
in one line...
if can be...You'll need to do updates to the system tables, (I believe) and so you'll need to allow ad-hoc updates on those tables - normally not allowed.

However, and I know this is not what you're asking, but I like not giving any permissions on tables, and only giving exec permissions on Stored Procs. This way you protect your tables and you limit what can be done / seen in your database by defining allowed requests and actions in the procedures.