Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
S

sea

@sea
About
Posts
15
Topics
9
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Error message with AutoNumber column issue- update DB
    S sea

    I implemented article “Inserting relational data using DataSet and DataAdapter” from this link: http://www.codeproject.com/cs/database/relationaladonet.asp[^] In my code. It has a perfect explanation; still I got stuck at one point. Debugger shows when that when I’m at this stage:

    static void CustDataAdapter_OnRowUpdate(object sender, OleDbRowUpdatedEventArgs e)
    {
    OleDbCommand custCmd = new OleDbCommand("SELECT @@IDENTITY", e.Command.Connection); //right after this line
    e.Row["CustID"] = custCmd.ExecuteScalar();
    e.Row.AcceptChanges();
    }

    This method defines the OleDbRowUpdatedEventHandler event, which comes to solve the AutoNumber column issue. I got a message box error: Problem populating dataset Box: [System.NullReferenceException: Object reference not set to an instance of an object at (object sender, OleDbRowUpdatedEventArgs e) in [path to file name] There is some more text below it, but this seems to be the main thing. Why do I get NullReferenceException? What did I missed? sea#

    C# help database com debugging question

  • checkedListBox binding with DataReader.
    S sea

    I’m writing ADO program connected to MS access with DataReader. Need to bind a checkedListBox to a table. This is what I wrote:

    	public void BindCheckedListBox(CheckedListBox BooksCheckedListBox)
    	{
    		ArrayList books = new ArrayList();
    		string sqlBindList = "SELECT BookName " +
    			"FROM books "+
    			"ORDER BY BookName ";
    
    		OleDbCommand cmdShowStock = new OleDbCommand();
    		cmdShowStock.Connection = cnShop;
    		cmdShowStock.CommandType = CommandType.Text;
    		cmdShowStock.CommandText = sqlBindList;
    		cnShop.Open();
    		OleDbDataReader reader = cmdShowStock.ExecuteReader();
    		BooksCheckedListBox.DataSource = reader;
    	}
    

    When run it with debbuger I get an exception: “Complex DataBinding accepts as a data source either an IList or an IListSource”. Trying to figure out how to work with those interfaces I got nowhere :(. Please help me clear up this issue! TIA, sea#

    C# help wpf wcf tutorial

  • combo box on a windows form
    S sea

    Wrote this code:

    private void SurveyChooserCombo_SelectedIndexChanged(object sender, EventArgs e)
    {
    if (SurveyChooserCombo.Text.Equals("Survey1"))
    SrNo = 1;
    else if (SurveyChooserCombo.Text.Equals("Survey2"))
    SrNo = 2;
    else if (SurveyChooserCombo.Text.Equals("Survey3"))
    SrNo = 3;
    else
    SrNo = 3;
    GetResults (SrNo);
    }

    stil event is not fired, dsiplay doesnot changed.

    C# help career

  • combo box on a windows form
    S sea

    Petras J. wrote: Are you sure you have added event handler? i.e. comboBox.SelectedIndexChanged+=new SelectionChangeHandler(<>) ??? I do have event handler. Petras J. wrote: - Another possibility is that the event may not be fired if combo box list style is not a selection from drop-down list but a mixture of type-in and select from the list... it is just an ordinary drop-down list. Nothing complicated. What else should I do to make it change once selction changed? TIA, sea#

    C# help career

  • combo box on a windows form
    S sea

    SrNo, which is an int represents survey no. Each time I change the item in combo, it is changed. "doesn't do the job" means SurveyChooserCombo.SelectedIndex seems to be left unchanged. When I run the application the form doesn't change the display as expected. Also cannot run it in debug mode, as I get "there is no source code available for current location", when trying to run over method more then once- to make the change in index come true. sea#

    C# help career

  • combo box on a windows form
    S sea

    I'm trying to use a combo box on a windows form which will change its display on event of changing combo selection. This is the method I wrote:

    private void SurveyChooserCombo_SelectedIndexChanged(object sender, EventArgs e)
    		{
    			DAL dal = new DAL();
    			switch (SurveyChooserCombo.SelectedIndex)
    			{
    				case 0:
    					SrNo = 1;
    					break;
    					
    				case 1:
    					SrNo = 2;
    					break;
    
    				case 2:
    					SrNo = 3;
    					break;
    				default:
                       SrNo = 3;
    					break;
    			}
    

    It doesn't do the job. Please help me find why. TIA, sea#

    C# help career

  • SQL SELECT statement syntax
    S sea

    This is my full method: public void CalcResults(int SrNo, out int total, out int Ans1, out int Ans2, out int Ans3) { string sqlTotal; string sqlAns1; string sqlAns2; string sqlAns3; //SQL statements if (SrNo>=1 & SrNo<=3) { sqlTotal= string.Format("SELECT COUNT(survey2) FROM ResultsTbl WHERE survey{0}<>0",SrNo); sqlAns1= string.Format("SELECT COUNT(survey2) FROM ResultsTbl WHERE survey{0}=1",SrNo); sqlAns2= string.Format("SELECT COUNT(survey2) FROM ResultsTbl WHERE survey{0}=2",SrNo); sqlAns3= string.Format("SELECT COUNT(survey2) FROM ResultsTbl WHERE survey{0}=3",SrNo); } else sqlAns1=sqlAns2=sqlAns3=sqlTotal="No answer was chosen"; //Command objects OleDbCommand cmdTotal = new OleDbCommand(sqlAns1, cnSurvey); OleDbCommand cmdAns1=new OleDbCommand(); OleDbCommand cmdAns2=new OleDbCommand(); OleDbCommand cmdAns3=new OleDbCommand(); cmdTotal.Connection = cnSurvey; cmdTotal.CommandType = CommandType.Text; cmdTotal.CommandText = sqlTotal; cmdAns1.Connection = cnSurvey; cmdAns1.CommandType = CommandType.Text; cmdAns1.CommandText = sqlAns1; cmdAns2.Connection = cnSurvey; cmdAns2.CommandType = CommandType.Text; cmdAns2.CommandText = sqlAns2; cmdAns3.Connection = cnSurvey; cmdAns3.CommandType = CommandType.Text; cmdAns3.CommandText = sqlAns3; //Connect cnSurvey.Open(); //Execute command total = int.Parse(cmdTotal.ExecuteScalar().ToString()); Ans1 = int.Parse(cmdAns1.ExecuteScalar().ToString()); Ans2 = int.Parse(cmdAns2.ExecuteScalar().ToString()); Ans3 = int.Parse(cmdAns3.ExecuteScalar().ToString()); //Disconnect cnSurvey.Close(); } The data is table like: username | survey1 | survey2 | survey3 ----------------------------------------------- sea# | 1 | 3 | 2 These are answers of a user to a survey. I need to collect all results from all users +total, so I can calculate statistics on it etc. TIA, sea#

    C# question database help

  • Basic combo box question
    S sea

    I'm trying to work with combo box, which will display graphically data I store in access DB. Each index no. has a column in the DB. means: choose option with index 1 from drop down list; get data & graph for column 1. Very simple & strait forward. I just cannot seem to grasp the idea of this combo box & what's running it. What is the event which will trigger the change of display? How do I pass item index no. to the method that connected to DB? You may send me a link to a site where I can view some simple examples of those? I've been looking all over & couldn't find something useful. sea#

    C# question database data-structures

  • SQL SELECT statement syntax
    S sea

    I need to bring the column no. as parameter. The table has 4 columns: username, survey1, survey2, survey3. SrNo is an int variable the method get. I want to find out How do take this SrNo and "glue" it with survey This is what I got from the article sqlTotal= "SELECT COUNT(survey@SrNo) FROM ResultsTbl "+ "WHERE survey@SrNo<>0"; cmdTotal.Parameters.Add("0", survey@SrNo); not to sue about survey@SrNo syntax. Got error in cmdTotal.Parameters.Add("0", survey@SrNo); under survey@SrNo. sea#

    C# question database help

  • SQL SELECT statement syntax
    S sea

    I'm using this SQL SELECT statement: int surveyNo sqlTotal= string.Format("SELECT COUNT(survey{0}) FROM ResultsTbl WHERE survey{0}<>0", surveyNo); I know the syntax is wrong in the parentheses after the COUNT. How do I fix this syntax, to put the variable value in? sea#

    C# question database help

  • GDI+ for survey results
    S sea

    I have to display the results of my MS Access DB application in graph. Figured it will be good to it with GDI+, but dont have a clue where to start from :confused: please throw me a line... sea#

    C# database winforms graphics data-structures

  • Move data between forms
    S sea

    I have a good authentication form, which I use to login to my app. Now I want to be able to know which user is logged-in now, in order to fill his answers in DB. In other words: I need to save & copy username (stored in text box of the authentication form) to other parts of application. I have Tried to save it in a static variable, and the call it from another form- no use. Any idea how would I do that? TIA, sea#

    C# database security question

  • Error while insert DB
    S sea

    The problem was with Password as a reserved word. once put it brackets around it- solved. cheers! Ronen

    C# database help question

  • Find user &amp; password in Access DB.
    S sea

    I'm writing a small app, and I have to prepare a form which will authenticate users. This is the code I wrote. The problem is I get exception in the marked line : "no value given for for on or more required parameters" What is wrong with it? Table name is users. Column name is UserName public void userExists(string username) { try {//SQL statements string sqlFinduser = "SELECT COUNT(UserName) AS UserNameExists " + "FROM users " + "WHERE (UserName=" + username + ")"; //Command object OleDbCommand cmdFindsqlFinduser = new OleDbCommand(); cmdFindsqlFinduser.Connection = cnSurvey; cmdFindsqlFinduser.CommandType = CommandType.Text; cmdFindsqlFinduser.CommandText = sqlFinduser; //Connect cnSurvey.Open(); //Execute command int count = int.Parse(cmdFindsqlFinduser.ExecuteScalar().ToString()); //error is right here bool exists = count != 0 ? true : false; //Disconnect cnSurvey.Close(); //Return result // return exists; } catch(Exception ex) { MessageBox.Show(ex.Message); } } TIA, Ronen

    C# database help question

  • Child form, which stays in front
    S sea

    I'm looking for a way to make an authentication form to my windows form based app. I want this form to be left in front of the parent main form, until user succeccfuly authenticate. If he press cancel it close the parent form. No other from may be load in front if this authentication form. TIA, Ronen Ronen

    C# security
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups