Set trigger points in SQL

I wanted to set High and Low trigger points to refresh data from SQL s

Page 1 of 1

1 Replies - 593 Views - Last Post: 27 October 2010 - 11:31 AM

#1 srinivasks33  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 26-October 10

Set trigger points in SQL

Posted 27 October 2010 - 11:25 AM


I'm developing a application using a windows form application using C# and SQL server database. As soon as the form is loaded I do display 500 rows of data on the screen I use richTextbox to display the data. The data is simple message in each row.

Now I wanted to set a trigger point in SQL in such way that if the user scrolls past a certain scroll position i.e after 300 rows I need to add the recent 300 rows of data from the database and display it and the same case if the user moves up the richtextbox should be loaded with old 300 rows of data. Any help is appreciated as I'm struggling a lot to sort out this issue.

I will be receiving the communication continuosly from the Serial port so there is always a new data in the SQL server database.

My code to insert data into database is as follows:

private void TerminalForm_Load(object sender, EventArgs e)
SqlConnection con;
SqlCommand cmd;
SqlDataAdapter sda;
string qry = "";

qry = "INSERT INTO [Example].[dbo].[SystemConsole1]([time],[Message])VALUES(GETDATE(),'" + rtTerminal.Text + "')";
con = new SqlConnection("Data Source=SRINIVAS-PC\\SQLEXPRESS;Database=SystemConsole;Trusted_Connection=True");
cmd = new SqlCommand(qry, con);
if (con.State == ConnectionState.Open)


To display the data from the database I use following code:

private void rtTerminal_keyDown(object sender, EventArgs e)
SqlConnection conn = new SqlConnection("Data Source=YOUR-0Z71CK0XVX\\SQLEXPRESS;Initial Catalog=Example;Integrated Security=True");
DataSet ds = new DataSet();
SqlDataAdapter adapter = new SqlDataAdapter(
"SELECT TOP 500 (Message) from Example.dbo.logFile order by Time desc", conn);
foreach (DataRow row in ds.Tables[0].Rows)
for (int i = 0; i < ds.Tables[0].Columns.Count; i++)
rtTerminal.Text += row[i].ToString() + Environment.NewLine;

rtTerminal.Text += Environment.NewLine;


Where rtTerminal is the richtextbox which I use to display the data from the database. Could anyone please advice me how I can set a "High" and "Low" trigger points in order to refresh the data.. Any help is appreciated in advance..

Is This A Good Question/Topic? 0
  • +

Replies To: Set trigger points in SQL

#2 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6246
  • View blog
  • Posts: 24,014
  • Joined: 23-August 08

Re: Set trigger points in SQL

Posted 27 October 2010 - 11:31 AM

Do NOT cross-post.

Topic closed.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1