Click here to Skip to main content
16,006,013 members
Home / Discussions / C#
   

C#

 
AnswerRe: Remote Object with Singleton mode ?? Pin
S. Senthil Kumar16-Jul-05 9:24
S. Senthil Kumar16-Jul-05 9:24 
Generalei need help Pin
Member 145978315-Jul-05 21:57
Member 145978315-Jul-05 21:57 
GeneralRe: ei need help Pin
Lord Kixdemp16-Jul-05 8:18
Lord Kixdemp16-Jul-05 8:18 
GeneralSQL SELECT statement syntax Pin
sea#15-Jul-05 21:32
sea#15-Jul-05 21:32 
GeneralRe: SQL SELECT statement syntax Pin
Dave Kreskowiak16-Jul-05 6:45
mveDave Kreskowiak16-Jul-05 6:45 
GeneralRe: SQL SELECT statement syntax Pin
sea#16-Jul-05 9:10
sea#16-Jul-05 9:10 
GeneralRe: SQL SELECT statement syntax Pin
Dave Kreskowiak16-Jul-05 15:49
mveDave Kreskowiak16-Jul-05 15:49 
GeneralRe: SQL SELECT statement syntax Pin
sea#17-Jul-05 6:02
sea#17-Jul-05 6:02 
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#
Generalfind blue tooth lan connection from registry Pin
ksanju100015-Jul-05 21:18
ksanju100015-Jul-05 21:18 
QuestionHow do we know which rows got deleted in DataTable? Pin
rudy.net15-Jul-05 20:09
rudy.net15-Jul-05 20:09 
GeneralRe: DataGrid's row Color Change Pin
rudy.net15-Jul-05 20:16
rudy.net15-Jul-05 20:16 
GeneralRe: DataGrid's row Color Change Pin
rudy.net16-Jul-05 10:12
rudy.net16-Jul-05 10:12 
Generalusing custom actions Pin
sianatia15-Jul-05 19:13
sianatia15-Jul-05 19:13 
GeneralLoad rtf file into a richtextbox while retaining format information Pin
sparks_lu15-Jul-05 12:58
sparks_lu15-Jul-05 12:58 
GeneralRe: Load rtf file into a richtextbox while retaining format information Pin
Dave Kreskowiak15-Jul-05 17:13
mveDave Kreskowiak15-Jul-05 17:13 
GeneralQuestions about Kernel32.dll's Beep() Pin
Lord Kixdemp15-Jul-05 11:52
Lord Kixdemp15-Jul-05 11:52 
GeneralRe: Questions about Kernel32.dll's Beep() Pin
Rob Graham15-Jul-05 12:50
Rob Graham15-Jul-05 12:50 
GeneralRe: Questions about Kernel32.dll's Beep() Pin
Dave Kreskowiak15-Jul-05 17:12
mveDave Kreskowiak15-Jul-05 17:12 
GeneralRe: Questions about Kernel32.dll's Beep() Pin
leppie15-Jul-05 22:11
leppie15-Jul-05 22:11 
GeneralRe: Questions about Kernel32.dll's Beep() Pin
Lord Kixdemp16-Jul-05 7:45
Lord Kixdemp16-Jul-05 7:45 
GeneralRe: Questions about Kernel32.dll's Beep() Pin
Rob Graham16-Jul-05 12:29
Rob Graham16-Jul-05 12:29 
GeneralRe: Questions about Kernel32.dll's Beep() Pin
Anonymous18-Jul-05 14:41
Anonymous18-Jul-05 14:41 
QuestionInheriting from Constraint ??? Pin
Besinci15-Jul-05 10:58
Besinci15-Jul-05 10:58 
AnswerRe: Inheriting from Constraint ??? Pin
leppie15-Jul-05 22:13
leppie15-Jul-05 22:13 
GeneralPrinting to debug window from Web Service Pin
maskeen15-Jul-05 10:41
maskeen15-Jul-05 10:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.