|
Currently i m using sql server 2000. when i directly modify the values inside the database the following TRIGGER fires correctly. But when pass values from front end (ASP.NET with C#, .net 2005, 2.0 framework) "update tbl_ORA_TBOps set Percentage_Compliant=((@comp/@tot_ex)*100) where AutoID=@id" this alone not working.. what problem.....? plz..
CREATE TRIGGER [calc] ON dbo.tbl_ORA_TBOps
AFTER INSERT, UPDATE
AS
begin
update tbl_ORA_TBOps set Total=(Compliant+Non_Compliant+InProgress+InputNotReceived+NA)
update tbl_ORA_TBOps set Total_Excl_NA=Total-NA
end
begin
declare @tot numeric
declare @na numeric
declare @tot_ex numeric
declare @comp numeric
declare @id numeric
select @tot=(Select total from inserted)
select @na=(Select NA from inserted)
select @tot_ex=(Select Total_Excl_NA from inserted)
select @comp=(Select Compliant from inserted)
select @id=(Select AutoID from inserted)
if (@tot=@na)
begin
update tbl_ORA_TBOps set Percentage_Compliant=100 where AutoID=@id
end
else
if (@tot_ex=0)
begin
update tbl_ORA_TBOps set Percentage_Compliant=0 where AutoID=@id
end
else
begin
update tbl_ORA_TBOps set Percentage_Compliant=((@comp/@tot_ex)*100) where AutoID=@id
end
end
in the above trigger, i m getting incorrect Percentage_Compliant value. how to solve this (i m very beginner to TRIGGERS). is the IF...ELSE loop correct? HELP ME! - KARAN
|
|
|
|
|
Hi
I have a CSS file that has some styles defined in it. now i need to use same in webusercontrol how can i? i tried to use tag also but it is not available there as there is no tag.
|
|
|
|
|
Visual Studio might not suggest the LINK there because ASCX forms part of another HTML (ASPX) page. This is to uphold valid XHTMLization of your page.
However, you can go ahead and use Link Tag, which would be obeyed by your web browser.
Vasudevan Deepak Kumar
Personal Homepage Tech Gossips
A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson
|
|
|
|
|
U mean to say i can use link tag even if it does not appear in inteelisence and even then it will be recognised by browser.
Plz Reply
|
|
|
|
|
Go ahead*. But ensure that the path is fine.
*There might be an XHTML tradeoff in the process.
Vasudevan Deepak Kumar
Personal Homepage Tech Gossips
A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson
|
|
|
|
|
|
Hi All !
I have a file "file.txt":
9056_09/04/08_08:04:03_WEB_BÁN_NTP_1,000_66,000_100_66,000_6 ,600,000_19,800!09/04/08_08:04:32_100_66,000_19,800*9566_17/04/08_10:04:06_PHONE_MUA_ACB_14,100_88,200_14,100_88, 200_1,243,620,000_2,735,964!17/04/08_09:04:13_100_88,200_19,404#17/04/08_09:04:13_400_88,200_77,616#17/04/08_09:04:13_500_88,200_97,020#17/04/08_09:04:13_2,100_88,200_407,484#17/04/08_09:04:13_100_88,200_19,404#17/04/08_09:04:13_300_88,200_58,212#17/04/08_09:04:13_500_88,200_97,020#17/04/08_09:04:13_600_88,200_116,424#17/04/08_09:04:13_300_88,200_58,212#17/04/08_09:04:13_300_88,200_58,212#17/04/08_09:04:13_1,200_88,200_232,848#17/04/08_09:04:13_1,200_88,200_232,848#17/04/08_09:04:13_200_88,200_38,808#17/04/08_09:04:13_500_88,200_97,020#17/04/08_09:04:13_100_88,200_19,404#17/04/08_09:04:13_500_88,200_97,020#17/04/08_09:04:13_1,000_88,200_194,040#17/04/08_09:04:13_900_88,200_174,636#17/04/08_09:04:13_200_88,200_38,808#17/04/08_09:04:13_700_88,200_135,828#17/04/08_09:04:13_2,000_88,200_388,080#17/04/08_09:04:13_400_88,200_77,616*9582_17/04/08_10:04:31_PHONE_BÁN_NTP_10,300_61,000_2,500_61, 000_152,500,000_442,250!17/04/08_10:04:56_1,000_61,000_176,900#17/04/08_10:04:56_1,500_61,000_265,350*9671_18/04/08_08:04:08_PHONE_BÁN_PVI_9,000_43,100_9,000_43,1 00_387,900,000_1,047,330!18/04/08_08:04:33_9,000_43,100_1,047,330*9791_21/04/08_08:04:23_PHONE_BÁN_NTP_7,800_56,800_7,800_56,8 00_443,040,000_1,196,208!21/04/08_08:04:15_500_56,800_76,680#21/04/08_08:04:18_1,000_56,800_153,360#21/04/08_08:04:19_2,000_56,800_306,720#21/04/08_08:04:19_500_56,800_76,680#21/04/08_08:04:42_100_56,800_15,336#21/04/08_08:04:43_100_56,800_15,336#21/04/08_08:04:34_500_56,800_76,680#21/04/08_08:04:22_100_56,800_15,336#21/04/08_08:04:32_100_56,800_15,336#21/04/08_08:04:37_100_56,800_15,336#21/04/08_08:04:47_2,500_56,800_383,400#21/04/08_08:04:09_200_56,800_30,672#21/04/08_08:04:13_100_56,800_15,336*10039_23/04/08_08:04:02_PHONE_BÁN_ACB_14,100_82,400_14,100_82 ,400_1,161,840,000_2,556,048!23/04/08_08:04:18_500_82,400_90,640#23/04/08_08:04:06_500_82,400_90,640#23/04/08_08:04:21_400_82,400_72,512#23/04/08_08:04:21_200_82,400_36,256#23/04/08_08:04:58_1,000_82,400_181,280#23/04/08_08:04:38_10,100_82,400_1,830,928#23/04/08_08:04:43_100_82,400_18,128#23/04/08_08:04:53_500_82,400_90,640#23/04/08_08:04:45_100_82,400_18,128#23/04/08_08:04:02_100_82,400_18,128#23/04/08_08:04:04_600_82,400_108,768*10446_28/04/08_08:04:15_DIRECT_MUA_ACB_6,800_82,100_5,000_82,1 00_410,500,000_1,231,500!28/04/08_08:04:35_5,000_82,100_1,231,500*10458_28/04/08_08:04:21_DIRECT_MUA_VNC_2,400_27,000_2,400_27,0 00_64,800,000_226,800!28/04/08_08:04:19_100_27,000_9,450#28/04/08_08:04:19_500_27,000_47,250#28/04/08_08:04:19_900_27,000_85,050#28/04/08_08:04:19_900_27,000_85,050*10467_28/04/08_09:04:20_DIRECT_MUA_VNC_1,200_27,000_1,200_27,0 00_32,400,000_113,400!28/04/08_09:04:19_1,200_27,000_113,400*10468_28/04/08_09:04:43_DIRECT_MUA_VNC_200_27,000_200_27,000_5 ,400,000_18,900!28/04/08_09:04:56_200_27,000_18,900*10476_28/04/08_09:04:35_DIRECT_MUA_VNC_2,500_27,000_2,500_27,0 00_67,500,000_236,250!28/04/08_09:04:13_2,500_27,000_236,250*10478_28/04/08_09:04:40_DIRECT_MUA_VNC_500_26,800_500_26,800_1 3,400,000_46,900!28/04/08_09:04:20_500_26,800_46,900*10494_28/04/08_10:04:11_DIRECT_MUA_VNC_200_27,000_200_27,000_5 ,400,000_18,900!28/04/08_10:04:05_200_27,000_18,900*10516_28/04/08_10:04:12_DIRECT_MUA_VNC_100_27,000_100_27,000_2 ,700,000_9,450!28/04/08_10:04:49_100_27,000_9,450*10535_28/04/08_11:04:36_DIRECT_MUA_ACB_12,100_84,100_12,100_84 ,100_1,017,610,000_2,544,025!28/04/08_10:04:02_7,100_84,100_1,492,775#28/04/08_10:04:02_5,000_84,100_1,051,250*10602_29/04/08_08:04:01_WEB_MUA_DQC_2,000_79,500_2,000_76,500_ 153,000,000_413,100!29/04/08_08:04:56_2,000_76,500_413,100*
I process below:
using System.Text.RegularExpressions;
using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using System.IO;
public partial class Default : System.Web.UI.Page
{
DataSet myDataSet;
DataTable aTable;
protected void Page_Load(object sender, EventArgs e)
{
// BuildDataSet();
}
protected void Button1_Click(object sender, EventArgs e)
{
string ret_Val = "";
ret_Val = TextBox1.Text;
if (ret_Val.Length > 50)
{
OutPut_Val(ret_Val);
}
else
{
Response.Write("<br> Không có thông tin !");
}
}
#region BuildDataSet
public void BuildDataSet()
{
//--------------Bind Table...........
myDataSet = new DataSet();
aTable = new DataTable("Table 1");
myDataSet.Tables.Add("Table 1");
//Creates and names the 12 columns data from file 2cylinintegers.dat and adds to Table 1
DataColumn Column1 = new DataColumn("SH Lenh");
DataColumn Column2 = new DataColumn("Ngay");
DataColumn Column3 = new DataColumn("Gio");
DataColumn Column4 = new DataColumn("Kenh GD");
DataColumn Column5 = new DataColumn("Lenh");
DataColumn Column6 = new DataColumn("MaCk");
DataColumn Column7 = new DataColumn("KL Dat");
DataColumn Column8 = new DataColumn("Gia Dat");
DataColumn Column9 = new DataColumn("KL Khop");
DataColumn Column10 = new DataColumn("Gia TB");
DataColumn Column11 = new DataColumn("Tong tien");
DataColumn Column12 = new DataColumn("Tong phi");
myDataSet.Tables["Table 1"].Columns.Add(Column1);
myDataSet.Tables["Table 1"].Columns.Add(Column2);
myDataSet.Tables["Table 1"].Columns.Add(Column3);
myDataSet.Tables["Table 1"].Columns.Add(Column4);
myDataSet.Tables["Table 1"].Columns.Add(Column5);
myDataSet.Tables["Table 1"].Columns.Add(Column6);
myDataSet.Tables["Table 1"].Columns.Add(Column7);
myDataSet.Tables["Table 1"].Columns.Add(Column8);
myDataSet.Tables["Table 1"].Columns.Add(Column9);
myDataSet.Tables["Table 1"].Columns.Add(Column10);
myDataSet.Tables["Table 1"].Columns.Add(Column11);
myDataSet.Tables["Table 1"].Columns.Add(Column12);
StreamReader myReader = new StreamReader(@"c:\demo.txt");
//Checks to see if the Reader has reached the end of the stream
while (myReader.Peek() > -1)
{
//Reads a line of data from the data file
string myString = myReader.ReadLine().Trim();
//Uses Regex.Split method to create an array of strings that represents each entry in the line.
string[] split = System.Text.RegularExpressions.Regex.Split(myString, "\\s+", RegexOptions.None);
//Adds the array as a new DataRow to Table 1
myDataSet.Tables["Table 1"].Rows.Add(split);
// DataRow theRow = myDataSet.Tables["Table 1"].NewRow();
// theRow["SH Lenh"] = (decimal)split[0];
//theRow["Ngay"] = (decimal)split[1];
//theRow["Gio"] = (decimal)split[2];
//theRow["Kenh GD"] = (decimal)split[3];
//theRow["Lenh"] = (decimal)split[4];
//theRow["MaCk"] = (decimal)split[5];
//theRow["KL Dat"] = (decimal)split[6];
//theRow["Gia Dat"] = (decimal)split[7];
//theRow["KL Khop"] = (decimal)split[8];
//theRow["Gia TB"] = (decimal)split[9];
//theRow["Tong tien"] = (decimal)split[10];
//theRow["Tong phi"] = (decimal)split[11];
// myDataSet.Tables["Table 1"].Rows.Add(theRow);
}
MyGrid.DataSource = myDataSet.Tables["Table 1"];
MyGrid.DataSource = myDataSet;
//Rows = input_String.Split('*');
////Rows = input_String.StartsWith('*');
//for (Idx = 0; Idx <= Rows.GetUpperBound(0) - 1; Idx++)
//{
// Pos = Rows[Idx].IndexOf('!');
// Master[0] = Rows[Idx].Substring(0, Pos);
// Master[1] = Rows[Idx].Substring(Pos + 1, Rows[Idx].Length - Pos - 1);
// {
// tmp_Str = "";
// Val = Master[0].Split('_');
// for (Child_Idx = 0; Child_Idx <= Val.GetUpperBound(0); Child_Idx++)
// {
// tmp_Str = tmp_Str + " " + Val[Child_Idx];
// //Response.Write("XX"+Val[Child_Idx].ToString());//fan tu cuoi cung cua !
// }
// Response.Write("<br>" + tmp_Str);
// }
// Child = Master[1].Split('#');
//for (Master_Idx = 0; Master_Idx <= Child.GetUpperBound(0); Master_Idx++)
//{
// tmp_Str = "";
// Val = Child[Master_Idx].Split('_');
// for (Child_Idx = 1; Child_Idx <= Val.GetUpperBound(0); Child_Idx++)
// {
// tmp_Str = tmp_Str + " " + Val[Child_Idx];
// // Response.Write("**");//cac' fan tu gia' gtri cua !
// }
// Response.Write("<br>" + tmp_Str);
//}
//-------------------------------end process..........
}
#endregion
private void OutPut_Val(string input_String)
{
DataTable TableName = new DataTable();
// string columns = input_String.Split(remove.ToCharArray());
//result.Tables.Add(TableName);
//stringbuild.Append("");
string[] Master = new string[2];
string[] Child;
string[] Rows;
string[] Val;
string tmp_Str;
int Pos;
byte Idx;
byte Master_Idx;
byte Child_Idx;
string outs = "";
string tmp_Date = "";
Response.Write("<br> Chi ti?t l?nh: ");
Response.Write("<br>");
Response.Write(" SH Lenh Ngay Gio Kenh GD Lenh Ma CK KL dat Gia dat KL khop Gia TB Tong tien Tong phi");
// foreach(string cols in columns)
if (input_String.Length < 10)
return;
Rows = input_String.Split('*');
for (Idx = 0; Idx <= Rows.GetUpperBound(0) - 1; Idx++)
{
Pos = Rows[Idx].IndexOf('!');
Master[0] = Rows[Idx].Substring(0, Pos);
Master[1] = Rows[Idx].Substring(Pos + 1, Rows[Idx].Length - Pos - 1);
{
tmp_Str = "";
Val = Master[0].Split('_');
for (Child_Idx = 0; Child_Idx <= Val.GetUpperBound(0); Child_Idx++)
{
tmp_Str = tmp_Str + " " + Val[Child_Idx];
//Response.Write("XX"+Val[Child_Idx].ToString());//fan tu cuoi cung cua !
}
Response.Write("<br>" + tmp_Str);
}
Child = Master[1].Split('#');
for (Master_Idx = 0; Master_Idx <= Child.GetUpperBound(0); Master_Idx++)
{
tmp_Str = "";
Val = Child[Master_Idx].Split('_');
for (Child_Idx = 1; Child_Idx <= Val.GetUpperBound(0); Child_Idx++)
{
tmp_Str = tmp_Str + " " + Val[Child_Idx];
//Response.Write(Val[Child_Idx]);//cac' fan tu gia' gtri cua !
// hpLink.Text = tmp_Str + Val[Child_Idx].ToString();
}
Response.Write("<br>" + tmp_Str);
}
}
//----------------------------//
// create a string type variable to generate dynamic table
string dynTable = "";
// start with table tag with following attributes
dynTable = "<table cellspacing=\"0\" cellpadding=\"2\" border=\"1\">";
dynTable += "<tr>";
dynTable += "<td>SH Lenh";
dynTable += "</td>";
dynTable += "<td>Ngay";
dynTable += "</td>";
dynTable += "<td>Gio";
dynTable += "</td>";
dynTable += "<td>Kenh GD";
dynTable += "</td>";
dynTable += "<td>Lenh";
dynTable += "</td>";
dynTable += "<td>Ma Ck";
dynTable += "</td>";
dynTable += "<td>KL dat";
dynTable += "</td>";
dynTable += "<td>Gia dat";
dynTable += "</td>";
dynTable += "<td>KL Khop";
dynTable += "</td>";
dynTable += "<td>Gia TB";
dynTable += "</td>";
dynTable += "<td>Tong tien";
dynTable += "</td>";
dynTable += "<td>Tong phi";
dynTable += "</td>";
dynTable += "<td>Chi tiet";
dynTable += "</td>";
dynTable += "</tr>";
// outer loop to generate table rows
for (Idx = 0; Idx <= Rows.GetUpperBound(0) - 1; Idx++)
{
dynTable += "<tr>";
Pos = Rows[Idx].IndexOf('!');
Master[0] = Rows[Idx].Substring(0, Pos);
Master[1] = Rows[Idx].Substring(Pos + 1, Rows[Idx].Length - Pos - 1);
//Response.Write(Master[0].ToString()+"<br>");
Response.Write(Rows[0].ToString());
tmp_Str = "";
Val = Master[0].Split('_');
if (Val[1] == tmp_Date)
{
Val[1] = " ";
}
else
{
tmp_Date = Val[1];
}
for (Child_Idx = 0; Child_Idx <= Val.GetUpperBound(0); Child_Idx++)
{
///tmp_Str = tmp_Str + " " + Val[Child_Idx];
//Response.Write("XX"+Val[Child_Idx].ToString( ));//fan tu cuoi cung cua !
dynTable += "<td>";
dynTable += Val[Child_Idx];
// close td column tag
dynTable += "</td>";
}
dynTable += "<td>";
dynTable += "<a href=\"Default_Detail.aspx\">";
dynTable += "Chi tiet";
dynTable += "</a>";
dynTable += "</td>";
dynTable += "</tr>";
Response.Write("<br>" + tmp_Str);
}
/* for (Master_Idx = 0; Master_Idx <= Child.GetUpperBound(0); Master_Idx++)
{
tmp_Str = "";
Val = Child[Master_Idx].Split('_');
for (Child_Idx = 1; Child_Idx <= Val.GetUpperBound(0); Child_Idx++)
{
// tmp_Str = tmp_Str + " " + Val[Child_Idx];
// Response.Write("**");//cac' fan tu gia' gtri cua !
//hpLink.Text = Val[Child_Idx];
}
Response.Write("<br>" + tmp_Str);
}
* Click vao chi tiet.. no' se hien thi doan code nay... tuong ung voi tung ma lenh.
*/ Child = Master[1].Split('#');
// close the table tag
dynTable += "</table>";
Literal1.Text = dynTable;
}
}
code HTML:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Label ID="_message" runat="server"
Text="" Visible="false"></asp:Label>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" /><br />
<br />
<br />
<asp:GridView ID="MyGrid" runat="server" AutoGenerateColumns="False" Width="303px">
</asp:GridView>
<asp:Label ID="Literal1" runat="server" Text="Label"></asp:Label>
<br />
</div>
</form>
</body>
</html>
I have a problem:
- I want to click the "SH Lenh" and display this subchild by "SH Lenh"
ex:
9566 17/04/08 10:04:06 PHONE MUA ACB 14,100 88,200 14,100 88,200 1,243,620,000 2,735,964
con cua no' co' cac ma sau:
09:04:13 100 88,200 19,404
09:04:13 400 88,200 77,616
09:04:13 500 88,200 97,020
09:04:13 2,100 88,200 407,484
09:04:13 100 88,200 19,404
09:04:13 300 88,200 58,212
09:04:13 500 88,200 97,020
09:04:13 600 88,200 116,424
09:04:13 300 88,200 58,212
09:04:13 300 88,200 58,212
09:04:13 1,200 88,200 232,848
09:04:13 1,200 88,200 232,848
09:04:13 200 88,200 38,808
09:04:13 500 88,200 97,020
09:04:13 100 88,200 19,404
09:04:13 500 88,200 97,020
09:04:13 1,000 88,200 194,040
09:04:13 900 88,200 174,636
09:04:13 200 88,200 38,808
09:04:13 700 88,200 135,828
09:04:13 2,000 88,200 388,080
09:04:13 400 88,200 77,616
Can you tell me how to process????
this is my email:phuhoapro@yahoo.com
thanks to ALL !
RICHING MINDS,CHANGING LIVE
|
|
|
|
|
|
Hi All !
I have a file "file.txt":
9056_09/04/08_08:04:03_WEB_BÁN_NTP_1,000_66,000_100_66,000_6 ,600,000_19,800!09/04/08_08:04:32_100_66,000_19,800*9566_17/04/08_10:04:06_PHONE_MUA_ACB_14,100_88,200_14,100_88, 200_1,243,620,000_2,735,964!17/04/08_09:04:13_100_88,200_19,404#17/04/08_09:04:13_400_88,200_77,616#17/04/08_09:04:13_500_88,200_97,020#17/04/08_09:04:13_2,100_88,200_407,484#17/04/08_09:04:13_100_88,200_19,404#17/04/08_09:04:13_300_88,200_58,212#17/04/08_09:04:13_500_88,200_97,020#17/04/08_09:04:13_600_88,200_116,424#17/04/08_09:04:13_300_88,200_58,212#17/04/08_09:04:13_300_88,200_58,212#17/04/08_09:04:13_1,200_88,200_232,848#17/04/08_09:04:13_1,200_88,200_232,848#17/04/08_09:04:13_200_88,200_38,808#17/04/08_09:04:13_500_88,200_97,020#17/04/08_09:04:13_100_88,200_19,404#17/04/08_09:04:13_500_88,200_97,020#17/04/08_09:04:13_1,000_88,200_194,040#17/04/08_09:04:13_900_88,200_174,636#17/04/08_09:04:13_200_88,200_38,808#17/04/08_09:04:13_700_88,200_135,828#17/04/08_09:04:13_2,000_88,200_388,080#17/04/08_09:04:13_400_88,200_77,616*9582_17/04/08_10:04:31_PHONE_BÁN_NTP_10,300_61,000_2,500_61, 000_152,500,000_442,250!17/04/08_10:04:56_1,000_61,000_176,900#17/04/08_10:04:56_1,500_61,000_265,350*9671_18/04/08_08:04:08_PHONE_BÁN_PVI_9,000_43,100_9,000_43,1 00_387,900,000_1,047,330!18/04/08_08:04:33_9,000_43,100_1,047,330*9791_21/04/08_08:04:23_PHONE_BÁN_NTP_7,800_56,800_7,800_56,8 00_443,040,000_1,196,208!21/04/08_08:04:15_500_56,800_76,680#21/04/08_08:04:18_1,000_56,800_153,360#21/04/08_08:04:19_2,000_56,800_306,720#21/04/08_08:04:19_500_56,800_76,680#21/04/08_08:04:42_100_56,800_15,336#21/04/08_08:04:43_100_56,800_15,336#21/04/08_08:04:34_500_56,800_76,680#21/04/08_08:04:22_100_56,800_15,336#21/04/08_08:04:32_100_56,800_15,336#21/04/08_08:04:37_100_56,800_15,336#21/04/08_08:04:47_2,500_56,800_383,400#21/04/08_08:04:09_200_56,800_30,672#21/04/08_08:04:13_100_56,800_15,336*10039_23/04/08_08:04:02_PHONE_BÁN_ACB_14,100_82,400_14,100_82 ,400_1,161,840,000_2,556,048!23/04/08_08:04:18_500_82,400_90,640#23/04/08_08:04:06_500_82,400_90,640#23/04/08_08:04:21_400_82,400_72,512#23/04/08_08:04:21_200_82,400_36,256#23/04/08_08:04:58_1,000_82,400_181,280#23/04/08_08:04:38_10,100_82,400_1,830,928#23/04/08_08:04:43_100_82,400_18,128#23/04/08_08:04:53_500_82,400_90,640#23/04/08_08:04:45_100_82,400_18,128#23/04/08_08:04:02_100_82,400_18,128#23/04/08_08:04:04_600_82,400_108,768*10446_28/04/08_08:04:15_DIRECT_MUA_ACB_6,800_82,100_5,000_82,1 00_410,500,000_1,231,500!28/04/08_08:04:35_5,000_82,100_1,231,500*10458_28/04/08_08:04:21_DIRECT_MUA_VNC_2,400_27,000_2,400_27,0 00_64,800,000_226,800!28/04/08_08:04:19_100_27,000_9,450#28/04/08_08:04:19_500_27,000_47,250#28/04/08_08:04:19_900_27,000_85,050#28/04/08_08:04:19_900_27,000_85,050*10467_28/04/08_09:04:20_DIRECT_MUA_VNC_1,200_27,000_1,200_27,0 00_32,400,000_113,400!28/04/08_09:04:19_1,200_27,000_113,400*10468_28/04/08_09:04:43_DIRECT_MUA_VNC_200_27,000_200_27,000_5 ,400,000_18,900!28/04/08_09:04:56_200_27,000_18,900*10476_28/04/08_09:04:35_DIRECT_MUA_VNC_2,500_27,000_2,500_27,0 00_67,500,000_236,250!28/04/08_09:04:13_2,500_27,000_236,250*10478_28/04/08_09:04:40_DIRECT_MUA_VNC_500_26,800_500_26,800_1 3,400,000_46,900!28/04/08_09:04:20_500_26,800_46,900*10494_28/04/08_10:04:11_DIRECT_MUA_VNC_200_27,000_200_27,000_5 ,400,000_18,900!28/04/08_10:04:05_200_27,000_18,900*10516_28/04/08_10:04:12_DIRECT_MUA_VNC_100_27,000_100_27,000_2 ,700,000_9,450!28/04/08_10:04:49_100_27,000_9,450*10535_28/04/08_11:04:36_DIRECT_MUA_ACB_12,100_84,100_12,100_84 ,100_1,017,610,000_2,544,025!28/04/08_10:04:02_7,100_84,100_1,492,775#28/04/08_10:04:02_5,000_84,100_1,051,250*10602_29/04/08_08:04:01_WEB_MUA_DQC_2,000_79,500_2,000_76,500_ 153,000,000_413,100!29/04/08_08:04:56_2,000_76,500_413,100*
I process below:
using System.Text.RegularExpressions;
using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using System.IO;
public partial class Default : System.Web.UI.Page
{
DataSet myDataSet;
DataTable aTable;
protected void Page_Load(object sender, EventArgs e)
{
// BuildDataSet();
}
protected void Button1_Click(object sender, EventArgs e)
{
string ret_Val = "";
ret_Val = TextBox1.Text;
if (ret_Val.Length > 50)
{
OutPut_Val(ret_Val);
}
else
{
Response.Write(" Không có thông tin !");
}
}
#region BuildDataSet
public void BuildDataSet()
{
//--------------Bind Table...........
myDataSet = new DataSet();
aTable = new DataTable("Table 1");
myDataSet.Tables.Add("Table 1");
//Creates and names the 12 columns data from file 2cylinintegers.dat and adds to Table 1
DataColumn Column1 = new DataColumn("SH Lenh");
DataColumn Column2 = new DataColumn("Ngay");
DataColumn Column3 = new DataColumn("Gio");
DataColumn Column4 = new DataColumn("Kenh GD");
DataColumn Column5 = new DataColumn("Lenh");
DataColumn Column6 = new DataColumn("MaCk");
DataColumn Column7 = new DataColumn("KL Dat");
DataColumn Column8 = new DataColumn("Gia Dat");
DataColumn Column9 = new DataColumn("KL Khop");
DataColumn Column10 = new DataColumn("Gia TB");
DataColumn Column11 = new DataColumn("Tong tien");
DataColumn Column12 = new DataColumn("Tong phi");
myDataSet.Tables["Table 1"].Columns.Add(Column1);
myDataSet.Tables["Table 1"].Columns.Add(Column2);
myDataSet.Tables["Table 1"].Columns.Add(Column3);
myDataSet.Tables["Table 1"].Columns.Add(Column4);
myDataSet.Tables["Table 1"].Columns.Add(Column5);
myDataSet.Tables["Table 1"].Columns.Add(Column6);
myDataSet.Tables["Table 1"].Columns.Add(Column7);
myDataSet.Tables["Table 1"].Columns.Add(Column8);
myDataSet.Tables["Table 1"].Columns.Add(Column9);
myDataSet.Tables["Table 1"].Columns.Add(Column10);
myDataSet.Tables["Table 1"].Columns.Add(Column11);
myDataSet.Tables["Table 1"].Columns.Add(Column12);
StreamReader myReader = new StreamReader(@"c:\demo.txt");
//Checks to see if the Reader has reached the end of the stream
while (myReader.Peek() > -1)
{
//Reads a line of data from the data file
string myString = myReader.ReadLine().Trim();
//Uses Regex.Split method to create an array of strings that represents each entry in the line.
string[] split = System.Text.RegularExpressions.Regex.Split(myString, "\\s+", RegexOptions.None);
//Adds the array as a new DataRow to Table 1
myDataSet.Tables["Table 1"].Rows.Add(split);
// DataRow theRow = myDataSet.Tables["Table 1"].NewRow();
// theRow["SH Lenh"] = (decimal)split[0];
//theRow["Ngay"] = (decimal)split[1];
//theRow["Gio"] = (decimal)split[2];
//theRow["Kenh GD"] = (decimal)split[3];
//theRow["Lenh"] = (decimal)split[4];
//theRow["MaCk"] = (decimal)split[5];
//theRow["KL Dat"] = (decimal)split[6];
//theRow["Gia Dat"] = (decimal)split[7];
//theRow["KL Khop"] = (decimal)split[8];
//theRow["Gia TB"] = (decimal)split[9];
//theRow["Tong tien"] = (decimal)split[10];
//theRow["Tong phi"] = (decimal)split[11];
// myDataSet.Tables["Table 1"].Rows.Add(theRow);
}
MyGrid.DataSource = myDataSet.Tables["Table 1"];
MyGrid.DataSource = myDataSet;
//Rows = input_String.Split('*');
////Rows = input_String.StartsWith('*');
//for (Idx = 0; Idx <= Rows.GetUpperBound(0) - 1; Idx++)
//{
// Pos = Rows[Idx].IndexOf('!');
// Master[0] = Rows[Idx].Substring(0, Pos);
// Master[1] = Rows[Idx].Substring(Pos + 1, Rows[Idx].Length - Pos - 1);
// {
// tmp_Str = "";
// Val = Master[0].Split('_');
// for (Child_Idx = 0; Child_Idx <= Val.GetUpperBound(0); Child_Idx++)
// {
// tmp_Str = tmp_Str + " " + Val[Child_Idx];
// //Response.Write("XX"+Val[Child_Idx].ToString());//fan tu cuoi cung cua !
// }
// Response.Write(" " + tmp_Str);
// }
// Child = Master[1].Split('#');
//for (Master_Idx = 0; Master_Idx <= Child.GetUpperBound(0); Master_Idx++)
//{
// tmp_Str = "";
// Val = Child[Master_Idx].Split('_');
// for (Child_Idx = 1; Child_Idx <= Val.GetUpperBound(0); Child_Idx++)
// {
// tmp_Str = tmp_Str + " " + Val[Child_Idx];
// // Response.Write("**");//cac' fan tu gia' gtri cua !
// }
// Response.Write(" " + tmp_Str);
//}
//-------------------------------end process..........
}
#endregion
private void OutPut_Val(string input_String)
{
DataTable TableName = new DataTable();
// string columns = input_String.Split(remove.ToCharArray());
//result.Tables.Add(TableName);
//stringbuild.Append("");
string[] Master = new string[2];
string[] Child;
string[] Rows;
string[] Val;
string tmp_Str;
int Pos;
byte Idx;
byte Master_Idx;
byte Child_Idx;
string outs = "";
string tmp_Date = "";
Response.Write(" Chi ti?t l?nh: ");
Response.Write(" ");
Response.Write(" SH Lenh Ngay Gio Kenh GD Lenh Ma CK KL dat Gia dat KL khop Gia TB Tong tien Tong phi");
// foreach(string cols in columns)
if (input_String.Length < 10)
return;
Rows = input_String.Split('*');
for (Idx = 0; Idx <= Rows.GetUpperBound(0) - 1; Idx++)
{
Pos = Rows[Idx].IndexOf('!');
Master[0] = Rows[Idx].Substring(0, Pos);
Master[1] = Rows[Idx].Substring(Pos + 1, Rows[Idx].Length - Pos - 1);
{
tmp_Str = "";
Val = Master[0].Split('_');
for (Child_Idx = 0; Child_Idx <= Val.GetUpperBound(0); Child_Idx++)
{
tmp_Str = tmp_Str + " " + Val[Child_Idx];
//Response.Write("XX"+Val[Child_Idx].ToString());//fan tu cuoi cung cua !
}
Response.Write(" " + tmp_Str);
}
Child = Master[1].Split('#');
for (Master_Idx = 0; Master_Idx <= Child.GetUpperBound(0); Master_Idx++)
{
tmp_Str = "";
Val = Child[Master_Idx].Split('_');
for (Child_Idx = 1; Child_Idx <= Val.GetUpperBound(0); Child_Idx++)
{
tmp_Str = tmp_Str + " " + Val[Child_Idx];
//Response.Write(Val[Child_Idx]);//cac' fan tu gia' gtri cua !
// hpLink.Text = tmp_Str + Val[Child_Idx].ToString();
}
Response.Write(" " + tmp_Str);
}
}
//----------------------------//
// create a string type variable to generate dynamic table
string dynTable = "";
// start with table tag with following attributes
dynTable = "";
dynTable += "";
dynTable += "";
dynTable += "";
dynTable += "";
dynTable += "";
dynTable += "";
dynTable += "";
dynTable += "";
dynTable += "";
dynTable += "";
dynTable += "";
dynTable += "";
dynTable += "";
dynTable += "";
dynTable += "";
// outer loop to generate table rows
for (Idx = 0; Idx <= Rows.GetUpperBound(0) - 1; Idx++)
{
dynTable += "";
Pos = Rows[Idx].IndexOf('!');
Master[0] = Rows[Idx].Substring(0, Pos);
Master[1] = Rows[Idx].Substring(Pos + 1, Rows[Idx].Length - Pos - 1);
//Response.Write(Master[0].ToString()+" ");
Response.Write(Rows[0].ToString());
tmp_Str = "";
Val = Master[0].Split('_');
if (Val[1] == tmp_Date)
{
Val[1] = " ";
}
else
{
tmp_Date = Val[1];
}
for (Child_Idx = 0; Child_Idx <= Val.GetUpperBound(0); Child_Idx++)
{
///tmp_Str = tmp_Str + " " + Val[Child_Idx];
//Response.Write("XX"+Val[Child_Idx].ToString( ));//fan tu cuoi cung cua !
dynTable += "";
}
dynTable += "";
dynTable += " ";
Response.Write(" " + tmp_Str);
}
/* for (Master_Idx = 0; Master_Idx <= Child.GetUpperBound(0); Master_Idx++)
{
tmp_Str = "";
Val = Child[Master_Idx].Split('_');
for (Child_Idx = 1; Child_Idx <= Val.GetUpperBound(0); Child_Idx++)
{
// tmp_Str = tmp_Str + " " + Val[Child_Idx];
// Response.Write("**");//cac' fan tu gia' gtri cua !
//hpLink.Text = Val[Child_Idx];
}
Response.Write(" " + tmp_Str);
}
* Click vao chi tiet.. no' se hien thi doan code nay... tuong ung voi tung ma lenh.
*/ Child = Master[1].Split('#');
// close the table tag
dynTable += "
SH Lenh";
dynTable += " | Ngay";
dynTable += " | Gio";
dynTable += " | Kenh GD";
dynTable += " | Lenh";
dynTable += " | Ma Ck";
dynTable += " | KL dat";
dynTable += " | Gia dat";
dynTable += " | KL Khop";
dynTable += " | Gia TB";
dynTable += " | Tong tien";
dynTable += " | Tong phi";
dynTable += " | Chi tiet";
dynTable += " | ";
dynTable += Val[Child_Idx];
// close td column tag
dynTable += " | ";
dynTable += "";
dynTable += "Chi tiet";
dynTable += "";
dynTable += " | ";
Literal1.Text = dynTable;
}
}
code HTML:
]]>
<title>Untitled Page
<asp:textbox id="TextBox1" runat="server">
<asp:label id="_message" runat="server">
Text="" Visible="false">
<asp:button id="Button1" runat="server" onclick="Button1_Click" text="Button">
<asp:gridview id="MyGrid" runat="server" autogeneratecolumns="False" width="303px">
<asp:label id="Literal1" runat="server" text="Label">
I have a problem:
- I want to click the "SH Lenh" and display this subchild by "SH Lenh"
ex:
9566 17/04/08 10:04:06 PHONE MUA ACB 14,100 88,200 14,100 88,200 1,243,620,000 2,735,964
con cua no' co' cac ma sau:
09:04:13 100 88,200 19,404
09:04:13 400 88,200 77,616
09:04:13 500 88,200 97,020
09:04:13 2,100 88,200 407,484
09:04:13 100 88,200 19,404
09:04:13 300 88,200 58,212
09:04:13 500 88,200 97,020
09:04:13 600 88,200 116,424
09:04:13 300 88,200 58,212
09:04:13 300 88,200 58,212
09:04:13 1,200 88,200 232,848
09:04:13 1,200 88,200 232,848
09:04:13 200 88,200 38,808
09:04:13 500 88,200 97,020
09:04:13 100 88,200 19,404
09:04:13 500 88,200 97,020
09:04:13 1,000 88,200 194,040
09:04:13 900 88,200 174,636
09:04:13 200 88,200 38,808
09:04:13 700 88,200 135,828
09:04:13 2,000 88,200 388,080
09:04:13 400 88,200 77,616
Can you tell me how to process????
this is my email:phuhoapro@yahoo.com
thanks to ALL !
RICHING MINDS,CHANGING LIVE
|
|
|
|
|
There is no use dumping a big pile of code. Just precisely, what are you intending to do in your 'string processing'. A relevant few lines code snippet would augment the troubleshooting process. Anything else would just help shoo-shooing away any assistance that you need to get.
Vasudevan Deepak Kumar
Personal Homepage Tech Gossips
A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson
|
|
|
|
|
I have created a page with a gridview that contained inventory information. Now when they want to add something to the database they click Add from a drop down list. Now what that does is opens another window using javascript from the codefile to about 500px by 400px.
In that popup window they have textboxes where they can enter in certain fields and add to that database. Now when they click add it adds and everything like it is suppose to but what I want it to do is update the grid view on the main page so when they add it shows what they have added in the gridview on the mainpage.
How would I accomplish this?
|
|
|
|
|
Your page which needs to be updated should give AJAX calls to the server frequently, get the data and bind to the grid.
|
|
|
|
|
I have not used AJAX at all. Is there any requirements that users are required to have in order to run AJAX? Also I forgot to mention but the main page is the page but the actual gridview is from a web control. I don't think it makes much of a different but thought I should share.
|
|
|
|
|
Are you talking about the Update Panel?
|
|
|
|
|
Jacob Dixon wrote: I have not used AJAX at all. Is there any requirements that users are required to have in order to run AJAX?
AJAX is javascript. You use XMLHttpRequest and XMLHttpResponse objects included in the browser to make AJAX calls. Users don't need to install anything, other than a supporting browser. Most of the browsers supports AJAX.
Jacob Dixon wrote: Also I forgot to mention but the main page is the page but the actual gridview is from a web control.
MS has a AJAX toolkit which provides easy interface to develop AJAX enabled applications. It's worth downloading. Use UpdatePanel control, put your webcontrol inside this update panel. Update panel is capable to update in the specified intervals. Gridview in webcontrol doesn't make any difference.
|
|
|
|
|
Ok I will give that a try, thanks a bunch! I didn't think it would make a difference about the web control but thought I should share just in case.
|
|
|
|
|
Ok I put my gridview in the UpdatePanel and it says I have to make a public property for GridView which its talking about the ID right?
|
|
|
|
|
Jacob Dixon wrote: I have to make a public property for GridView which its talking about the ID right?
I am not getting your point. Are you getting an error ?
|
|
|
|
|
Yes I am.. I fixed it, I found by searching google (took a few websites) but had to put :contenttemplate -- gridview here -- contenttemplate
How do I set how often it updates though? And does it refresh the page or can I point it to a method that just does: GridView.DataBind(); ?
|
|
|
|
|
It won't refresh the whole page. It will update only the panel area.
Jacob Dixon wrote: How do I set how often it updates though?
Use Timer control. Check this[^]
|
|
|
|
|
Before I re-invent the wheel, I thought I'd ask if anyone knew of such a beast. I've tried searching Google for various combinations of 'add', 'remove', 'listbox', 'asp.net', and I've only managed to find WinForm controls (see: http://www.vbdotnetheaven.com/UploadFile/mgold/AddRemoveUserControls04262005080452AM/AddRemoveUserControls.aspx[^])
For those that don't want to click the link, I'm basically looking for a control that has a list of items in listbox1 and buttons to move selected items to listbox 2. The main difficulty I find in doing it myself is getting the layout to work properly. I'm assuming you'd need to use CSS positioning to get everything lined up properly.
Josh
Find a penny, pick it up, and all day long you'll have a back-ache...
|
|
|
|
|
Those things are javascript driven and are as old as dirt. Search for javascript code to do this, not ASP.NET code.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I'm aware that the actual code to implement the functionality would be client side javascript. My main problem (which I probably didn't state clearly, and why I was looking for a control someone had already created) was how to actually create the layout of the control in a web application. I'm not very familiar with CSS positioning, but I'm assuming that is what I would need to get the control layout to mimic what can be done just by dragging the buttons around on a WinForm application. Perhaps since this is a CSS/positioning question, it might be better for another forum, but since I was looking for control that someone might have already created, I wanted to look here first. I've managed to create the layout using tables, so I guess that will be good enough.
Josh
Find a penny, pick it up, and all day long you'll have a back-ache...
|
|
|
|
|
Dear all,
what do you think is the best way to store html content for sections of the page.
The options is see are either storing in database which may be the easiest by can be slow or make use of some flat file or xml file. However with xml there will be problems with parsing because of the html tags.
What are your comments and suggestions?
Thanks a lot,
Chris
|
|
|
|
|
If you have worries about speed, a DB is going to be the fastest.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|