Click here to Skip to main content
15,908,674 members
Home / Discussions / C#
   

C#

 
Questiontif image file to binary format using C# Pin
Parvai11-Aug-07 19:54
Parvai11-Aug-07 19:54 
AnswerRe: tif image file to binary format using C# Pin
Expert Coming11-Aug-07 19:56
Expert Coming11-Aug-07 19:56 
QuestionCreating .msi file for A windows Service Application Pin
boneyds11-Aug-07 19:10
boneyds11-Aug-07 19:10 
QuestionURGENT!!! Folder security code needed Pin
aravinda77711-Aug-07 18:26
aravinda77711-Aug-07 18:26 
AnswerRe: URGENT!!! Folder security code needed Pin
Expert Coming11-Aug-07 19:58
Expert Coming11-Aug-07 19:58 
QuestionAsk for Windows application implement communication between many clients and one server Pin
liucaihua11-Aug-07 17:09
liucaihua11-Aug-07 17:09 
AnswerRe: Ask for Windows application implement communication between many clients and one server Pin
Ravi Bhavnani11-Aug-07 19:40
professionalRavi Bhavnani11-Aug-07 19:40 
Questionproblem to use thread.Abort() method. Pin
hdv21211-Aug-07 15:01
hdv21211-Aug-07 15:01 
AnswerRe: problem to use thread.Abort() method. Pin
Leslie Sanford11-Aug-07 15:29
Leslie Sanford11-Aug-07 15:29 
AnswerRe: problem to use thread.Abort() method. Pin
S. Senthil Kumar11-Aug-07 15:33
S. Senthil Kumar11-Aug-07 15:33 
QuestionGraphically rich menus (like Microsoft Word) Pin
Muhammad Nauman Yousuf11-Aug-07 12:26
Muhammad Nauman Yousuf11-Aug-07 12:26 
AnswerRe: Graphically rich menus (like Microsoft Word) Pin
Paul Conrad11-Aug-07 16:02
professionalPaul Conrad11-Aug-07 16:02 
AnswerRe: Graphically rich menus (like Microsoft Word) Pin
ekynox12-Aug-07 13:30
ekynox12-Aug-07 13:30 
QuestionUsing Orca to modify a user interface dialog. Pin
steve_rm11-Aug-07 12:08
steve_rm11-Aug-07 12:08 
QuestionAccessing a single class instance from external assemblies Pin
thg97111-Aug-07 10:27
thg97111-Aug-07 10:27 
AnswerRe: Accessing a single class instance from external assemblies Pin
S. Senthil Kumar11-Aug-07 15:39
S. Senthil Kumar11-Aug-07 15:39 
QuestionSimple Q about multidimension array .. plz Help Pin
legend_of_zanado11-Aug-07 9:07
legend_of_zanado11-Aug-07 9:07 
AnswerRe: Simple Q about multidimension array .. plz Help Pin
ScottM111-Aug-07 10:47
ScottM111-Aug-07 10:47 
GeneralRe: Simple Q about multidimension array .. plz Help Pin
Justin.Jones11-Aug-07 18:08
Justin.Jones11-Aug-07 18:08 
GeneralRe: Simple Q about multidimension array .. plz Help Pin
ScottM112-Aug-07 19:56
ScottM112-Aug-07 19:56 
QuestionNeed help with Sqldatareader Pin
erikhjerpe11-Aug-07 6:33
erikhjerpe11-Aug-07 6:33 
Hi im new to Both C# and sql and exept from that my problem is:

I´ve managed to connect to a mssql database (express edition) from my C# program and I have the sqldata reader to read my question to listboxes in my windowsForm. Ive understood from "Beginners guide to accessing SQL Server through C#" that once you got your connection running and the reader has read the table in the database You can rephrase your question without reading directly to the database.

If that is correct, Is it possible to establish a connection to the sql database in "program.cs" and get your reader to read the whole table and then let different windowsForms make sql questions to that reader? Im hoping to gain less questions to the DB and its supposed to get the table every five minutes or something.

I would be very happy if anyone could help me in this matter

Here is an example of code in my Form:

public partial class BinMonitor : Form<br />
    {<br />
        private SqlConnection conn;<br />
        private SqlCommand cmd;<br />
        private SqlDataReader reader;<br />
        string Sql;<br />
<br />
        public BinMonitor()<br />
        {<br />
            InitializeComponent();<br />
        }<br />
<br />
        private void Form1_Load(object sender, EventArgs e)<br />
        {<br />
                       <br />
        }<br />
        // Gets the actual time and returns to a textbox<br />
        private void timer1_Tick(object sender, EventArgs e)<br />
        {<br />
            textBox1.Text = DateTime.Now.ToLongTimeString();<br />
           <br />
        }<br />
        //gets values from DB once a minute<br />
        private void timer2_Tick(object sender, EventArgs e)<br />
        {<br />
            <br />
            listBox1.Items.Clear();<br />
            listBox2.Items.Clear();<br />
            listBox3.Items.Clear();<br />
            string connStr = "server=DBserver; user id=user; password=pwd; database=flights;Trusted_Connection=yes;";<br />
            SqlConnection conn = new SqlConnection(connStr);<br />
            conn.Open();<br />
            reader = null;<br />
            cmd = new SqlCommand("SELECT * FROM BinMonitor Where Departure !<" + "'" + textBox1.Text + "'" + "order by Departure ASC", conn);<br />
            reader = cmd.ExecuteReader();<br />
            reader.Read();<br />
<br />
            while (reader.Read())<br />
            {<br />
                listBox1.Items.Add(reader.GetString(0));<br />
                listBox2.Items.Add(reader.GetString(1));<br />
                listBox3.Items.Add(reader.GetString(2));<br />
            }<br />
        }<br />
            <br />
          <br />
        <br />
    }<br />
}


Lost in space
AnswerRe: Need help with Sqldatareader Pin
chinaQI11-Aug-07 7:10
chinaQI11-Aug-07 7:10 
GeneralRe: Need help with Sqldatareader Pin
erikhjerpe11-Aug-07 7:26
erikhjerpe11-Aug-07 7:26 
AnswerRe: Need help with Sqldatareader Pin
Colin Angus Mackay11-Aug-07 8:20
Colin Angus Mackay11-Aug-07 8:20 
GeneralRe: Need help with Sqldatareader Pin
erikhjerpe11-Aug-07 8:47
erikhjerpe11-Aug-07 8:47 

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.