Click here to Skip to main content
15,912,457 members
Home / Discussions / Database
   

Database

 
GeneralSET NOBROWSETABLE Pin
Axsys19-Jan-05 15:50
Axsys19-Jan-05 15:50 
GeneralRe: SET NOBROWSETABLE Pin
Mike Dimmick20-Jan-05 1:44
Mike Dimmick20-Jan-05 1:44 
GeneralCopy DataSet and change primary key in Relations Pin
triton63019-Jan-05 12:56
triton63019-Jan-05 12:56 
GeneralDateTime no Time transferred Pin
cje19-Jan-05 9:43
cje19-Jan-05 9:43 
GeneralRe: DateTime no Time transferred Pin
Michael Potter20-Jan-05 9:51
Michael Potter20-Jan-05 9:51 
GeneralQuery on 2 DB Pin
Sebastien Lachance19-Jan-05 9:35
Sebastien Lachance19-Jan-05 9:35 
GeneralRe: Query on 2 DB Pin
David Salter19-Jan-05 11:16
David Salter19-Jan-05 11:16 
QuestionDataBind causing infinite loop? Pin
Evan Schultz19-Jan-05 6:38
Evan Schultz19-Jan-05 6:38 
I am re-writing a control I was working on to use dynamically created template columns instead of using the designer for it. For one of my columns, I need a DropDown list, this worked in my old version fine. However, when writing the Databind event for the new control I am running into a problem where when I call the DataBind() on the listcontrol, it's causing an infinite loop.

It simply cuts out on the bind, and the method re-starts, I cant figure out why this is happening.

However, if I simply loop though all the items in the Dataset, and add them to the dropdown list that way, this works fine - however, much rather use databinding to do this.


private void TemplateControl_DataBindingDL(object sender,System.EventArgs e)
		{
			Debug.WriteLine("Starting DataBind:" + System.DateTime.Now);
			DropDownList lc;
			lc = (DropDownList) sender;
			string strSqlCommand;
			DataGridItem container = (DataGridItem) lc.NamingContainer;
			SqlConnection sqlConnection1 = new SqlConnection();
			DataSet dsTemp = new DataSet();
				strSqlCommand = "SELECT " + fieldName + " FROM V_T_TASKS GROUP BY " + fieldName;
			
			SqlDataAdapter sqlDataAdapter1 = new SqlDataAdapter(strSqlCommand,sqlConnection1);
			sqlConnection1.ConnectionString = "...//connection string";

			sqlConnection1.Open();
			sqlDataAdapter1.Fill(dsTemp);
			
			Debug.WriteLine("assigning datasource...");
			lc.DataSource = dsTemp;
			lc.DataTextField = fieldName;
			lc.DataValueField = fieldName;
			Debug.WriteLine("assignedg datasource... binding");
			Debug.WriteLine("Rows count=" + dsTemp.Tables[0].Rows.Count);
			lc.DataBind();
			Debug.WriteLine("..bound");
			dsTemp.Clear();
			Debug.WriteLine("Cleared...");
			lc.Items.Add( DataBinder.Eval(container.DataItem,fieldName,"{0}"));
			Debug.WriteLine("Ending DataBind:" + System.DateTime.Now);
			lc.SelectedIndex = 0;
			sqlConnection1.Close();
			
		}


When I run this, it'll just get to the last two debug statements, then jump back upto the start and keep looping - not throwing any errors or exceptions either.

If I take out the databind and replace it with a normal loop to add each item in the dataset, it works fine.

any ideas?
GeneralSQL - Autonumber - Remove Pin
Purple Monk19-Jan-05 1:50
Purple Monk19-Jan-05 1:50 
GeneralRe: SQL - Autonumber - Remove Pin
David Salter19-Jan-05 7:57
David Salter19-Jan-05 7:57 
GeneralRe: SQL - Autonumber - Remove Pin
Purple Monk19-Jan-05 23:21
Purple Monk19-Jan-05 23:21 
GeneralRe: SQL - Autonumber - Remove Pin
David Salter20-Jan-05 11:12
David Salter20-Jan-05 11:12 
GeneralSQL UPDATE Multiple Params Pin
Vector718-Jan-05 22:10
Vector718-Jan-05 22:10 
GeneralRe: SQL UPDATE Multiple Params Pin
Colin Angus Mackay18-Jan-05 22:59
Colin Angus Mackay18-Jan-05 22:59 
GeneralRe: SQL UPDATE Multiple Params Pin
Mike Dimmick18-Jan-05 23:02
Mike Dimmick18-Jan-05 23:02 
GeneralRe: SQL UPDATE Multiple Params Pin
Vector719-Jan-05 0:31
Vector719-Jan-05 0:31 
QuestionMSDE installation problem?? Pin
BSRK18-Jan-05 22:06
BSRK18-Jan-05 22:06 
QuestionWhere to keep my connection? Pin
Luis Alonso Ramos18-Jan-05 12:59
Luis Alonso Ramos18-Jan-05 12:59 
AnswerRe: Where to keep my connection? Pin
Colin Angus Mackay18-Jan-05 13:09
Colin Angus Mackay18-Jan-05 13:09 
AnswerRe: Where to keep my connection? Pin
Rob Graham18-Jan-05 15:41
Rob Graham18-Jan-05 15:41 
GeneralUsing NULLs in database fields Pin
Luis Alonso Ramos18-Jan-05 12:19
Luis Alonso Ramos18-Jan-05 12:19 
GeneralRe: Using NULLs in database fields Pin
Colin Angus Mackay18-Jan-05 12:49
Colin Angus Mackay18-Jan-05 12:49 
GeneralRe: Using NULLs in database fields Pin
Luis Alonso Ramos18-Jan-05 14:15
Luis Alonso Ramos18-Jan-05 14:15 
QuestionWhat is wrong with this SQL code Pin
Asabere18-Jan-05 9:02
Asabere18-Jan-05 9:02 
AnswerRe: What is wrong with this SQL code Pin
Colin Angus Mackay18-Jan-05 13:02
Colin Angus Mackay18-Jan-05 13:02 

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.