hello guys, how r u all?
i need a little help. plz if you can help me i'd thank u a lot.
so first of all, i need to know how to add an upload button and how to use it exactly.
second, I need to know how to do these actions ; i have 2 drop down lists and i want each drop down list to show me the information that the selected item have (sorry i'm not american so i can't find the right way to explain it but i'll try to give u an example)-> lets say in the first dropdownlist i have a collection from my database of car types, then i select "mercedes" after that i want to see in the second drpdownlst the types of each "mercedes" feild that i have in my database like (E,C..etc) .
last thing i wanna ask is if theres any way so i can show a "*.Doc" file inside the aspx page.????
sorry i know that i had many questions to ask but please answer me if u can because i have an exam soon.:(
Loading
basil farrajPosted Jun 7, 2007, 12:12 PM
bdesh tigerPosted Jun 5, 2007, 5:38 PM
Hi,
Try to do as follows:
1. Add two comboboxes and given them name
2. Add codes under lostfocus event of comboBox1 (double click on combo box and select the event either lostfocus or any suitable events)
3. add necessary declaration like
Using System.Data.OleDB....... as required
Also, you have to declare variables
public OleDbConnection cnn;
public OleDbCommand datacommand;
public OleDbDataReader datareader;
You need to modify code as per your requirement like fieldname etc...
//type code to open your database connection (cnn)
string s;
s = "select field1,field2 from yourtablename where typeofcar ='" + comboBox1.text +"'";
datacommand = new OleDbCommand(s,cnn);
comboBox2.Items.Clear(); //to clear the combobox
try {
datareader = datacommand.ExecuteReader();
while (datareader.Read())
{
object obValue = datareader.GetValue(1);
comboBox2.Items.Add(obValue.ToString());
}
//close database connection
}
catch (Exception ex) {MessageBox.Show (ex.Message); }
cnn.Close();
}
Hope for the best..
BT
Posted Jun 5, 2007, 4:46 PM
Basil, I will get back an answer to you complete with code after I get home. I have a really good idea to do what your talking about but its going to take quite a bit of coding and quite a bit of time... The latter of which I dont have much of while Im here at work, lol. Just hang on :)
EDIT:
Oh yeah, what kind of database are you working with? Or are you just reading from a .txt file?