A little SQL problem - نوشته شده در (881 Views)
Junior Member
thermal_seeker
مطلب: 430
430
MS SQL 2005 DB
I have created a form that is partially filled by bringing in data from another table.
The Username dropdown decides which table the data should go into and the other dropdown boxes are the columns in that table. Obviously I cant have the columns named because when the username dropdown is changed the other dropdowns are re-populated with different data.
Is it possible to have the columns linked to the results of the dropdowm boxes??
Code:

 PiggieWeightsDataSource.InsertCommand = String.Format("INSERT INTO {0} (freddie, bertie, gertie) VALUES(@freddie, @bertie, @gertie)", UNDropDown.SelectedItem.Text)


PiggieWeightsDataSource.InsertParameters.Add("freddie", P0TB.Text)
PiggieWeightsDataSource.InsertParameters.Add("bertie", P1TB.Text)
PiggieWeightsDataSource.InsertParameters.Add("gertie", P2TB.Text)


ie. "freddie" is the result of the selected text from dropdown box 2

bertie is the result of dropdown box 3

etc

Dave

No good at coding, but I can plough a field !!
 پیش‌فرض مرتب‌سازی برای تاریخ DESC به معنی جدیدترین است  
 تعداد در صفحه 
نوشته شده در
Snitz Forums Admin
ruirib
مطلب: 26364
26364
I guess you would need to create the SQL dinamically, considering the chosen values in the dropdowns.
نوشته شده در
Junior Member
thermal_seeker
مطلب: 430
430
Thanks Rui
That pointed me in the right direction smile
No good at coding, but I can plough a field !!
نوشته شده در
Snitz Forums Admin
ruirib
مطلب: 26364
26364
 
شما باید یک متن وارد کنید