Thank you very much...You've help me a lot... Thank you...
jacklynn_mei
Posts
-
Displaying data one by one using timer -
Displaying data one by one using timerThanks... But after tried, it wont loop to the first data. After reading the 3rd data, it will error since there is no data on the position 3 (4th data) (my table only have 3 data).
-
Displaying data one by one using timerI have done something like the code below But after reading the last data, it encounter error since there is no data persistent while reading. public partial class tempA : Form { SqlDataReader m_Reader; DataSet ds = new DataSet(); private void tempA_Load(object sender, EventArgs e) { string conStrg; conStrg = ("Data Source=DIMENSION3000\\SQLEXPRESS;Initial Catalog=kMasjid;User ID=sa;password=123456"); SqlConnection connTimer = new SqlConnection(conStrg); connTimer.Open(); string selSQL = "Select txtDesc FROM txtScroll"; SqlCommand com = new SqlCommand(selSQL, connTimer); SqlDataAdapter da = new SqlDataAdapter(com); da.Fill(ds, "txtScroll"); m_Reader = com.ExecuteReader(); m_Reader.Read(); Timer myTimer = new Timer(); myTimer.Interval = 5000; myTimer.Enabled = true; myTimer.Start(); myTimer.Tick += new EventHandler(Timer_Tick); } public void Timer_Tick(object sender, EventArgs e) { alphaTxtMain.Text = " " + m_Reader["txtDesc"]; m_Reader.Read() } }
-
Displaying data one by one using timerWinform Application
-
Displaying data one by one using timerHi... I have problem with my timer code. I want to display the data from the sql database on textbox using timer tick event. For an example there are 3 data in the database which are apple,banana,coconut. apple will appear first and after 10 seconds banana will appear, and after 10 seconds coconut will appear. And then, after the last data (coconut) appeared, the first data (apple) appeared again, and so on. It will continuously loop. I want to do like this. Any suggestion or reference? Thanks Jac
-
Timer Display data from databaseMmm..it's like blinking. Supposed that, the output is 10secs for each data to be displayed.
-
Timer Display data from databaseDude..have done like the code below but the data cannot display for 10secs. public load(....) { Timer myTimer = new Timer(); myTimer.Interval = 10000; myTimer.Enabled = true; myTimer.Tick += new EventHandler(Timer_Tick); } public void Timer_Tick(object sender, EventArgs e) { string conStrg; conStrg = ("Data Source=DIMENSION3000\\SQLEXPRESS;Initial Catalog=kMasjid;User ID=sa;password=123456"); SqlConnection connTimer = new SqlConnection(conStrg); connTimer.Open(); string selSQL = "Select txtDesc FROM txtScroll"; SqlCommand com = new SqlCommand(selSQL, connTimer); SqlDataReader reader = com.ExecuteReader(); DataSet ds = new DataSet(); while (reader.Read()) { alphaTxtMain.Text = " " + reader["txtDesc"]; myTimer.Interval = 10000; myTimer.Stop(); }
-
Timer Display data from databaseI have done something like the code below. It will display the data but, it won't display for 10 seconds it will read all the data from database then only the timer stop for 10 seconds. What i'm expected is, each data display at 10 seconds of time then only continue to the next data and so on... public load(....) { Timer myTimer = new Timer(); myTimer.Interval = 10000; myTimer.Enabled = true; myTimer.Tick += new EventHandler(Timer_Tick); } public void Timer_Tick(object sender, EventArgs e) { string conStrg; conStrg = ("Data Source=DIMENSION3000\\SQLEXPRESS;Initial Catalog=kMasjid;User ID=sa;password=123456"); SqlConnection connTimer = new SqlConnection(conStrg); connTimer.Open(); string selSQL = "Select txtDesc FROM txtScroll"; SqlCommand com = new SqlCommand(selSQL, connTimer); SqlDataReader reader = com.ExecuteReader(); DataSet ds = new DataSet(); while (reader.Read()) { alphaTxtMain.Text = " " + reader["txtDesc"]; myTimer.Interval = 10000; myTimer.Stop(); }
-
Timer Display data from databaseHello... Can some body help me with Timer? I want to display the data from my database. For an example: i) 1st data will be displayed ( 10 seconds) ii)After 10 seconds finish, 2nd data will be displayed iii) These data will be displayed continuously (looping) Please help me. Thanks in advance Jac
-
RichTextBox MarqueeDear Abhijit... Since i'm very new in c#, i hope that you can explain more detail... Thanks
-
RichTextBox MarqueeHello out there. How to marquee the richTextBox in winform? Thanks. Jac
-
[Message Deleted][Message Deleted]
-
Error on ISynchronizeInvoke castingoic... Actually the idea is like this: - i want to display all the record(s) inside the database - the connection is always there, so that i can retrieve the records. For an example, if i insert a new data the data will be displayed instantly (no need to refresh or debug once again). thanks, Jac
-
Error on ISynchronizeInvoke castingwhat should i do if i have an error in ISynchronizeInvoke casting. Actually i am doing a c# console application that use ISynchronizeInvoke the code is like this: ISynchronizeInvoke i = (ISynchronizeInvoke)this; The Error: Unable to cast object of type 'ArtIntelTania.Program' to type 'System.ComponentModel.ISynchronizeInvoke'. hope somebody can help me Thanks in advance Regard, jac
-
how to do the sqlClr connection & deploy it in c# Express Edition?ok then...thanks a lot for helping me.. regard, jac
-
how to do the sqlClr connection & deploy it in c# Express Edition?this is my trigger: CREATE TRIGGER AITrigger ON AIEvent FOR INSERT AS EXTERNAL NAME [AIClass].[AIClass.AICheck].[checkUserRole]
-
how to do the sqlClr connection & deploy it in c# Express Edition?then after i have read about the trigger..I do like this (will call AIClass at the main class): using System; using System.Collections.Generic; using System.Text; using Microsoft.SqlServer.Server; using System.Data; using System.Data.SqlClient; namespace AIClass { public class AICheck { [SqlTrigger(Event = "FOR INSERT", Name = "AITrigger", Target = "AIEvent")] public static void checkUserRole() { //if (!SqlContext.IsAvailable) //{ // Console.Write("Context none"); // Console.Read(); //} //else //{ SqlTriggerContext tgContext = SqlContext.TriggerContext; SqlConnection conn = new SqlConnection("Data Source=DIMENSION3000\\SQLEXPRESS; Initial Catalog=AITania; User Id=sa; Password=123456"); using ( conn = new SqlConnection("context connection=true")) { conn.Open(); //SqlCommand cmd = conn.CreateCommand(); SqlDataReader reader; //cmd.ExecuteNonQuery(); string msg = ""; if (tgContext.TriggerAction == TriggerAction.Insert) { SqlCommand sqlComm = new SqlCommand("SELECT * FROM INSERTED",conn); //cmd.CommandText = "SELECT * FROM INSERTED"; SqlContext.Pipe.ExecuteAndSend(sqlComm); //reader = cmd.ExecuteReader(); //sqlComm.Connection = conn; //sqlComm.CommandText = "SELECT * FROM INSERTED"; //for (int x = 0; x < tgContext.ColumnCount; ++x) //{ // msg += string.Format("Column {0} {1} been updated{2}", x, (tgContext.IsUpdatedColumn(x) ? "has" : "has not"), Environment.NewLine); //} for (int i = 0; i < reader.FieldCount; i++) { msg = msg + reader.GetName(i) + ":" + (string)reader[i] + " "; } } conn.Close(); } //} } } }
-
how to do the sqlClr connection & deploy it in c# Express Edition?At first I do like This => using System; using System.Collections.Generic; using System.Text.RegularExpressions; using Microsoft.CSharp; using Microsoft.SqlServer.Server; using System.Data; using System.Data.SqlClient; namespace AITania { class Program { //public static void InsertTrigger() //{ // SqlTriggerContext triggerContext = SqlContext.GetTriggerContext(); // SqlPipe sqlPipe = SqlContext.GetPipe(); // SqlCommand command = SqlContext.GetCommand(); // if (triggerContext.TriggerAction == System.Data.Sql.TriggerAction.Insert) // { // command.CommandText = "SELECT * FROM INSERTED"; // sqlPipe.Execute(command); // } //} static void Main(string[] args) { //---------------------------Database connection SqlConnection conn = new SqlConnection("Data Source=DIMENSION3000\\SQLEXPRESS; Initial Catalog=AITania; User Id=sa; Password=123456"); DataSet AlertDataSet = new DataSet(); SqlDataAdapter da; SqlCommandBuilder cmdBuilder; //--------------------------Open Connection conn.Open(); da = new SqlDataAdapter("SELECT * FROM AIEvent", conn); cmdBuilder = new SqlCommandBuilder(da); da.Fill(AlertDataSet, "AIEvent"); //-------------------------Displaying error foreach (DataRow dr in AlertDataSet.Tables[0].Rows) { Console.WriteLine("EventID: {0}", dr["EventID"]); Console.WriteLine("Time of Occur: {0}", dr["TimeOfOccur"]); Console.WriteLine("Location: {0}", dr["LocationID"]); Console.WriteLine(""); } Console.ReadLine(); //--------------------------Close Connection conn.Close(); //AIClass.AICheck.checkUserRole(); } } }
-
how to do the sqlClr connection & deploy it in c# Express Edition?oic...i have done the dataset but now the error is unhandled InvalidOperationException the error description is:-> The requested operation requires a SqlClr context, which is only available when running in the Sql Server process. I dont know how to use the SqlClr context how to write it in my code jac
-
how to do the sqlClr connection & deploy it in c# Express Edition?hem...so do u mean that i dont need the trigger function?...because i dont have any other way to get the real time data inserted in the database since the trigger function fired whenever any transaction made on that particular table. Before, i have done same thing that only using the dataset but if using the dataset i cant get the latest data (real time) inserted. regard Jac