I get the error message ‘Keyword not supported: ‘provider”, when using Sql Server why?
If you are using SqlConnection then the connection string should be as follows: server=localhost;uid=sa;password=;database=northwind i.e server=<yourservername>;uid=<youruid>;password=<yourpassword>;database=<yourdbName>’ For SqlConnection we do not provide a Provider . Provider is used in cases where OleDbConnection is used.
Why do I get the error message ‘The ConnectionString property has not been initialized’
Check if you have specified the connection string VB.NET dim cn as new SqlConnection(‘<your connection string>’) ’dim cn as new OleDdConnection(‘<your connection string>’) C# SqlConnection cn = new SqlConnection(‘<your connection string>’); OleDbConnection cn = new OleDbConnection(‘<your connection string>’);
How to maintain Line feeds when saving data to a database
Save the data entered in the multiline textbox as VB.NET .. cmd.Parameters.Add(new SqlParameter(‘@Notes’ ,SqlDbType.NVarChar )) cmd.Parameters (‘@Notes’).Value ='<pre>’ + TextBox1.Text + ‘</pre>’ …. cn.Open() cmd.ExecuteNonQuery() C# … cmd.Parameters.Add(new SqlParameter(‘@Notes’ ,SqlDbType.NVarChar )); cmd.Parameters [‘@Notes’].Value ='<pre>’ + TextBox1.Text + ‘</pre>’; …. cn.Open(); cmd.ExecuteNonQuery(); To retrieve the Data VB.NET Response.Write (ds.Tables(0).Rows(0)(‘Notes’).ToString ()) C# Response.Write (ds.Tables[0].Rows[0][‘Notes’].ToString ());
What is the significance of CommandBehavior.CloseConnection
To avoid having to explicitly close the connection associated with the command used to create either a SqlDataReader or and OleDbDataReader, pass the CommandBehavior.CloseConnection argument to the ExecuteReader method of the Connection. i.e VB.NET dr= cmd.ExecuteReader(CommandBehavior.CloseConnection) C# dr= cmd.ExecuteReader(CommandBehavior.CloseConnection); The associated connection will be closed automatically when the Close method of the Datareader is called. This makes it all the more important to always remember to call Close on your datareaders.
How can I display a Tool tip for a dropdownlist
The ToolTip property is inherited from the WebControl class and is not applicable to the DropDownList control. This implementation of the ToolTip property does not allow you to set a value and returns String. In a word, if we can make this (a dropdown with ToolTip) work with plain HTML and client side script, we should be able to emit the necessary code from ASP.NET. More Details at DropDownList.ToolTip Property