Click here to Skip to main content
15,890,123 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: textbox help needed..urgent pl Pin
Nirandas8-Jul-08 0:27
Nirandas8-Jul-08 0:27 
Questionmay i set fixed Screen rosolution inside asp.net 2.0 web application? Pin
Rameez Raja7-Jul-08 19:24
Rameez Raja7-Jul-08 19:24 
AnswerRe: may i set fixed Screen rosolution inside asp.net 2.0 web application? Pin
Herman<T>.Instance8-Jul-08 2:33
Herman<T>.Instance8-Jul-08 2:33 
QuestionDropDown List Box Pin
Murugavel Sadagopan7-Jul-08 19:22
Murugavel Sadagopan7-Jul-08 19:22 
AnswerRe: DropDown List Box Pin
amal_sathis7-Jul-08 20:18
amal_sathis7-Jul-08 20:18 
GeneralRe: DropDown List Box Pin
Murugavel Sadagopan7-Jul-08 20:34
Murugavel Sadagopan7-Jul-08 20:34 
GeneralRe: DropDown List Box Pin
Sherin Iranimose7-Jul-08 20:48
Sherin Iranimose7-Jul-08 20:48 
GeneralRe: DropDown List Box Pin
Herman<T>.Instance8-Jul-08 2:44
Herman<T>.Instance8-Jul-08 2:44 
I would create a class that accepts SqlParameter[] (Array).
Than you add the SqlParameter[] as addRange to the SqlConnection

Small Example?

SqlParameter[] parms = new SqlParameter[1];
parms[0] = new SqlParameter("@databaseID", dropDownList1.SelectedValue);

ddlDropDownlist2 = MyClass.FillMyDropDownList(ddlDropDownlist2, parms, "ddlText", "ddlID", "ConnectionString", "SqlCommandOrStoredProcedure");



public DropDownList FillMyDropDown(DropDownList ddlName, SqlParameter[] parms, String TextValue, String IDValue, String ConnectionName, String StoredProcedure)
{
SqlCommand cmd = null;
cmd = BaseDatabaseData(StoredProcedure, parms, ConnectionName);
ddlName.DataSource = cmd.ExecuteReader(CommandBehavior.CloseConnection);
ddlName.DataTextField = TextValue;
ddlName.DataValueField = IDValue;
ddlName.DataBind()
cmd.Connection.Close();

return ddlName;
}

private SqlCommand BaseDatabaseData(String StoredProc, SqlParameter[] arrParameters, String ConnectionName)
		{
			try
			{
                String connection = System.Configuration.ConfigurationManager.ConnectionStrings[ConnectionName].ConnectionString;
				SqlConnection con = new SqlConnection(connection);

				SqlCommand cmd = new SqlCommand(StoredProc, con);
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.Parameters.AddRange(arrParameters);
				cmd.CommandTimeout = 3600;
				cmd.UpdatedRowSource = UpdateRowSource.None;

				if (cmd.Connection.State.Equals(ConnectionState.Open))
					cmd.Connection.Close();
				
				cmd.Connection.Open();
				return cmd;
			}
			catch (Exception err)
			{
				throw new Exception(err.Message, err.InnerException);
			}
		}

QuestionGet Fullpath from treeview when node selected Pin
thedom27-Jul-08 19:07
thedom27-Jul-08 19:07 
QuestionView / modify file metadata Pin
kaushik_Manoj7-Jul-08 18:20
kaushik_Manoj7-Jul-08 18:20 
QuestionIntegrate desktop application with browser??? Pin
Technobizz7-Jul-08 17:47
Technobizz7-Jul-08 17:47 
AnswerRe: Integrate desktop application with browser??? Pin
Luc Pattyn7-Jul-08 17:58
sitebuilderLuc Pattyn7-Jul-08 17:58 
QuestionRe: Integrate desktop application with browser??? [modified] Pin
Technobizz7-Jul-08 18:29
Technobizz7-Jul-08 18:29 
AnswerRe: Integrate desktop application with browser??? Pin
Luc Pattyn8-Jul-08 2:09
sitebuilderLuc Pattyn8-Jul-08 2:09 
QuestionSave Page As Pin
zzsoulzz7-Jul-08 16:21
zzsoulzz7-Jul-08 16:21 
AnswerRe: Save Page As Pin
Herman<T>.Instance8-Jul-08 2:47
Herman<T>.Instance8-Jul-08 2:47 
GeneralRe: Save Page As Pin
zzsoulzz8-Jul-08 4:17
zzsoulzz8-Jul-08 4:17 
QuestionWeb service partial trust problem Pin
Bert delaVega7-Jul-08 16:19
Bert delaVega7-Jul-08 16:19 
AnswerNevermind - Re: Web service partial trust problem Pin
Bert delaVega7-Jul-08 17:04
Bert delaVega7-Jul-08 17:04 
QuestionDropDown ADD items Pin
Murugavel Sadagopan7-Jul-08 16:13
Murugavel Sadagopan7-Jul-08 16:13 
AnswerRe: DropDown ADD items Pin
Aavesh Agarwal7-Jul-08 17:03
Aavesh Agarwal7-Jul-08 17:03 
Questionidea my software bussiness Pin
raquidd227-Jul-08 13:28
raquidd227-Jul-08 13:28 
AnswerRe: idea my software bussiness Pin
Paul Conrad7-Jul-08 13:33
professionalPaul Conrad7-Jul-08 13:33 
AnswerRe: idea my software bussiness Pin
Christian Graus7-Jul-08 17:39
protectorChristian Graus7-Jul-08 17:39 
QuestionASP.NET MVC Pin
dabs7-Jul-08 12:36
dabs7-Jul-08 12:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.