hey man...i tried your suggestions and in the first one it writes again to database system.Data.DataRowView when i select the item from combobox i mean when i fill it with the datas from my db but it works for the item that i select from txt file....and it is same for the second one
Hi. I'm having problems in showing all the data to a listbox. all of the data will be coming from a database and will be shown depending on the choices of the user. i tried to code it but it didn't work. here's my code:
string sConnection = "Provider = Microsoft.Jet.OLEDB.4.0;" + "Data Source = Schedule.mdb";
using (OleDbConnection dbConnect = new OleDbConnection(sConnection))
if (prog == "CS")
string sqlString = "SELECT cs_firstcourse, cs_secondcourse, cs_thirdcourse, cs_fourthcourse, cs_fifthcourse, cs_sixthcourse, cs_seventhcourse, cs_eighthcourse, cs_ninthcourse FROM CS WHERE cs_year = @chosenYear AND cs_term = @chosenTerm;";
OleDbCommand dbCmd = new OleDbCommand();
dbCmd.CommandText = sqlString;
dbCmd.Connection = dbConnect;
using (OleDbDataReader dbReader = dbCmd.ExecuteReader())
if (dbReader.Read() == true)
for (int a = 0; a < 9; a++)
MessageBox.Show("An error has occured while trying to retrieve data from the database", "Class Scheduling: Database Access Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
I've built hardware destroyers into embedded code before - if the software believes the hardware has been copied and the firmware pirated, it blows the PSU, and anything else it can get it's hands on. One of our asian distributors and a paraniod MD prompted that one...
All those who believe in psycho kinesis, raise my hand.
I did something less severe several years ago. A company I worked for that I didn't completely trust used some software that I wrote in my own time that they relied on. I knew they wouldn't pay me for it (I was right) but it made my life so much easier whilst I was there so I permitted it's use making sure the T&Cs stated clearly that only I had the right to use the application at anytime and it was owned by me.
I wrote a 'bomb' in it that corrupted the exe if I didn't log on for a certain period. All the data that was used however (the data is of course their property) was placed at this point in unencrypted text files so they could access it but could no longer process it using *my* software.
After we inevitably parted company, the software went 'boom' atfter the expected ammount of time I pointed them to the text files when they rang to ask WTF and told them to go **** themselves. One of the highlights of my life
ok. i understand now. i'll just transfer the code to a method (which didn't occured to me a while ago). what i first thought is if i put the code inside the method of the listbox the database will be opened once i clicked the listbox and since i need the data to be in the listbox before i click the listbox it will be too late so i put it in the constructor which i think is the best place because once the method of the form has ran the database will be open until i close the form.
Object reference not set to an instance of an object.
For my first answer i asumed that you have already added a Session variable of type int with name Product_Number. The point is that you can use ToString() method to get a string representation of your variable which is a numeric type.
Here is a full example:
Session["Product_Number"] = 555; //Store
string s = Session["Product_Number"].ToString(); //Retrieve