Wrox Programmer Forums
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 15th, 2006, 04:06 PM
Registered User
 
Join Date: May 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Text

I am creating a customer search application and looking for some advice. I enter customer id - 000000000001 into textbox click button to search. Data is binded via textboxes below correctly. When I attempt to re-enter new id e.g. 000000000054 in entry textbox, click search button, I receive error:

{This causes two bindings in the collection to bind to the same property.\r\nParameter name: binding"}

I tried to us dataset clear() method but does not work. What am I missing or what can I use to correct this.

public void button3_Click(object sender, EventArgs e)
{

string select = "select * from customer where master_customer_id=" + textBox3.Text;
string source = @"Data Source=DB;database=TTST;User id=sa;Password=;";
SqlConnection conn = new SqlConnection(source);
conn.Open();
//Use SqlDataAdapter to fill rows to dataset
SqlDataAdapter da = new SqlDataAdapter(select, conn);
DataSet ds = new DataSet();
da.Fill(ds, "Customer");

//Binding Data to Textbox Control
textBox1.DataBindings.Add("Text", ds, "customer.first_name");
textBox2.DataBindings.Add("Text", ds, "customer.last_name");

}

}


 
Old May 19th, 2006, 05:55 AM
Friend of Wrox
 
Join Date: May 2006
Posts: 106
Thanks: 0
Thanked 0 Times in 0 Posts
Default

use textBox1.DataBindings.Clear();

Bijgupt





Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert Text(Sql Server Text Field) to Image(JPG) srinivas72 ADO.NET 2 February 13th, 2009 06:31 PM
Text Box .text Property Displays conflicting Valus JPOhlman Visual Basic 2005 Basics 3 August 23rd, 2006 02:39 PM
insert text into a text box by selecting an link gavmc Other Programming Languages 0 February 15th, 2006 09:46 AM
Extract text from text file & put in dropdown box tsukey Beginning PHP 5 July 20th, 2004 09:49 PM
Ch3, P.76 - text.html/text.php not working Hostile BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 4 May 15th, 2004 11:09 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.