Psygnus Posted July 26, 2005 Posted July 26, 2005 Hello everybody! I'm sorry to post about this issue again but i've read almost all posts that i found and couldn't get the answer :o (stupid) (Nobody uses C++.NET anymore???) What i need to understand is how to bind a TextBox 's Text with a column of a Database Table. I ' ve connected my Form to a db Table named "Managers" creating an oleDbConnection and oleDbAdapter and then i generated a Dataset. I want now to bind the Text property of a Textbox, with the column "Name" of the table "Managers". So i write the following: textBox1->DataBindings->Add(new System::Windows::Forms::Binding(S"Text", this->dataSet11 ,S"Managers.Name" )); What's wrong with this? I feel that i miss the point and the code above isn't the problem... Please help me as you can! Thank you in advance! Quote
Administrators PlausiblyDamp Posted July 26, 2005 Administrators Posted July 26, 2005 My C++ isn't the best but try changing the code to something like textBox1->DataBindings->Add(new System::Windows::Forms::Binding(S"Text", this->dataSet11.Tables["Managers"] ,S"Name" )); Not sure if the .Tables[] syntax is correct - the idea is to refere to the DataTable in the 2nd parameter... Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Psygnus Posted July 26, 2005 Author Posted July 26, 2005 I tried in C# the code you 've written for me for the same thing. textBox1.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataSet11.Tables["Managers"] , "Name")); There are no syntax errors but the text of the textbox doesn't change... As i said i think i miss the point... The funny thing is that the examples for the databindings in MSDN are exactly like the ones you and i wrote! Why the heck doesn't it work!!!!???? Quote
Administrators PlausiblyDamp Posted July 26, 2005 Administrators Posted July 26, 2005 Does the dataset contain any data? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Psygnus Posted July 26, 2005 Author Posted July 26, 2005 Oh S**T!!!!!!! Why it always has to be SO SIMPLE?@!@#!$!#% You search all day to find a bug and in the end you find out that you 're a bug yourself.... I had the line that fills the dataset in comments@#%!%!!!!$%^& I feel so stupid...!! Thank you a lot PlausiblyDamp...! Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.