Click here to Skip to main content
15,895,557 members
Home / Discussions / Database
   

Database

 
QuestionSSIS and parsing empty strings to integers Pin
PIEBALDconsult16-Aug-12 7:56
mvePIEBALDconsult16-Aug-12 7:56 
AnswerRe: SSIS and parsing empty strings to integers Pin
Mycroft Holmes16-Aug-12 12:54
professionalMycroft Holmes16-Aug-12 12:54 
GeneralRe: SSIS and parsing empty strings to integers Pin
PIEBALDconsult16-Aug-12 14:37
mvePIEBALDconsult16-Aug-12 14:37 
GeneralRe: SSIS and parsing empty strings to integers Pin
Mycroft Holmes16-Aug-12 17:25
professionalMycroft Holmes16-Aug-12 17:25 
AnswerRe: SSIS and parsing empty strings to integers Pin
S Douglas14-Sep-12 8:38
professionalS Douglas14-Sep-12 8:38 
Questionhow to spilt the attributes dispatch container planning in Shipment project Pin
SubiyaPalanisamy16-Aug-12 4:35
SubiyaPalanisamy16-Aug-12 4:35 
AnswerRe: how to spilt the attributes dispatch container planning in Shipment project Pin
Eddy Vluggen16-Aug-12 5:35
professionalEddy Vluggen16-Aug-12 5:35 
QuestionCumulative addition among views. Pin
pamelaannegarcia12-Aug-12 7:43
pamelaannegarcia12-Aug-12 7:43 



The program I created aims to display values on the seen textboxes. Values to be displayed here are computed via queries which utilize database views. (vw0112, vw0212, etc.) Currently, the program can perform displaying of monthly reports. The queries I’ve used to generate the values to be displayed are cut and stored on string variables because I need some parts of it to be dynamic (i.e. name of the view). For example, if I choose March on the first dropdown box, the value 03 will be generated and stored in a variable. If you choose 2012 in the year dropdown box, the value 12 will be stored in a variable. A formula is created for the program to be able to generate the view name, in our case, vw0312. My problem is that, I want for the program to perform cumulative addition on the values to be displayed on the textboxes based from the months to be chosen by the user. For example, if the user chooses March and June on the two drop boxes respectively, then what the report should display on each of the textboxes should be the sum of the values of the queries from the month of March to the month of June.


C#
static string notdoh = " AND (hospital Not In ('SOUTHERN ISABELA GENERAL HOSPITAL','CAGAYAN VALLEY MEDICAL CENTER','VETERANS REGIONAL HOSPITAL'))";

static string where_pg1 = "WHERE hosp_categ Not In ('S','T') And hosp_class='G' " + notdoh;
static string where_pg2 = " Or hosp_categ=' ' And hosp_class='G' " + notdoh;

static string where_prigov = where_pg1 + where_pg2;

//Claim_Amount
string sel_amt = "SELECT SUM(totalamount)";
string fr_amt_orig = "FROM vw";
string fr_amt = "FROM vw";
string SQLquery_amt = "";

//Claim_Count
string sel_count = "SELECT COUNT(*)";
string fr_count_orig = "FROM vw";
string fr_count = "FROM vw";
string SQLquery_count = "";

string qm = " ";
string var;

SqlCommand cmd = new SqlCommand();
string SQL_cmd = "";

public void amount(int slctdind1_p, int ind1_p, string sub_p)
{
if ((slctdind1_p + 1) < 10)
		var = "0";
	else
		var = "";
	fr_amt += (var + ind1_p + sub_p);
	SQLquery_amt = sel_amt + qm + fr_amt;
	fr_amt = fr_amt_orig;
}

public void count(int slctdind1_p, int ind1_p, string sub_p)
{
	if ((slctdind1_p + 1) < 10)
		var = "0";
	else
		var = "";
	fr_count += (var + ind1_p + sub_p);
	SQLquery_count = sel_count + qm + fr_count;
	fr_count = fr_count_orig;
}


public void btnGenerateGov_Click(object sender, EventArgs e)
{

cnn.ConnectionString = Properties.Settings.Default.DBInfo;
	string year = cbYearGov.Text;
	string sub = year.Substring(2, 2);

	int slctdind1 = cbMonthGov.SelectedIndex;
	int slctdind2 = cbMonth2Gov.SelectedIndex;
	int ind1 = slctdind1 + 1;
	int ind2 = slctdind2 + 1;

	//Claim_Amount_Region_Province
	amount(slctdind1, ind1, sub);

	//Claim_Count_Region_Province
	count(slctdind1, ind1, sub);

	try
	{
	cnn.Open();
      
		#region government
	      //Region_Prim_Gov_Claims
	      SQL_cmd = SQLquery_count + " " + where_prigov;
	      txtPGClaims.Text = claims(cmd, SQL_cmd);
	
	//Region_Prim_Gov_Amt
	      SQL_cmd = SQLquery_amt + " " + where_prigov;
	txtPGAmt.Text = claims(cmd, SQL_cmd);
}

AnswerRe: Cumulative addition among views. Pin
Mycroft Holmes12-Aug-12 18:29
professionalMycroft Holmes12-Aug-12 18:29 
QuestionHelp with Decimal Roundings Pin
Vimalsoft(Pty) Ltd12-Aug-12 0:51
professionalVimalsoft(Pty) Ltd12-Aug-12 0:51 
AnswerRe: Help with Decimal Roundings Pin
Eddy Vluggen12-Aug-12 1:10
professionalEddy Vluggen12-Aug-12 1:10 
GeneralRe: Help with Decimal Roundings Pin
Vimalsoft(Pty) Ltd12-Aug-12 2:01
professionalVimalsoft(Pty) Ltd12-Aug-12 2:01 
AnswerRe: Help with Decimal Roundings Pin
Niladri_Biswas21-Aug-12 22:39
Niladri_Biswas21-Aug-12 22:39 
QuestionHow to convert Physical XML files into Sqlserver Tables? Pin
Member 400654610-Aug-12 13:10
Member 400654610-Aug-12 13:10 
AnswerRe: How to convert Physical XML files into Sqlserver Tables? Pin
PIEBALDconsult10-Aug-12 13:32
mvePIEBALDconsult10-Aug-12 13:32 
AnswerRe: How to convert Physical XML files into Sqlserver Tables? Pin
Eddy Vluggen10-Aug-12 23:52
professionalEddy Vluggen10-Aug-12 23:52 
QuestionHow do you use the AVG api in sql to manage grouped output? Pin
Xarzu10-Aug-12 13:04
Xarzu10-Aug-12 13:04 
AnswerRe: How do you use the AVG api in sql to manage grouped output? Pin
Paul Conrad10-Aug-12 20:18
professionalPaul Conrad10-Aug-12 20:18 
GeneralRe: How do you use the AVG api in sql to manage grouped output? Pin
Xarzu11-Aug-12 13:30
Xarzu11-Aug-12 13:30 
AnswerRe: How do you use the AVG api in sql to manage grouped output? Pin
Paul Conrad11-Aug-12 13:32
professionalPaul Conrad11-Aug-12 13:32 
AnswerRe: How do you use the AVG api in sql to manage grouped output? Pin
Eddy Vluggen10-Aug-12 22:17
professionalEddy Vluggen10-Aug-12 22:17 
AnswerRe: How do you use the AVG api in sql to manage grouped output? Pin
Niladri_Biswas21-Aug-12 22:51
Niladri_Biswas21-Aug-12 22:51 
QuestionHow to store a standard selection? Pin
Jörgen Andersson10-Aug-12 9:57
professionalJörgen Andersson10-Aug-12 9:57 
AnswerRe: How to store a standard selection? Pin
R. Giskard Reventlov10-Aug-12 10:02
R. Giskard Reventlov10-Aug-12 10:02 
GeneralRe: How to store a standard selection? Pin
Jörgen Andersson10-Aug-12 10:09
professionalJörgen Andersson10-Aug-12 10:09 

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.