Click here to Skip to main content
15,912,400 members
Home / Discussions / C#
   

C#

 
GeneralRe: Passing info from a thread Pin
Ennis Ray Lynch, Jr.30-May-08 6:04
Ennis Ray Lynch, Jr.30-May-08 6:04 
GeneralRe: Passing info from a thread Pin
Judah Gabriel Himango30-May-08 7:39
sponsorJudah Gabriel Himango30-May-08 7:39 
QuestionSortable List<t></t> Pin
eggsovereasy30-May-08 4:18
eggsovereasy30-May-08 4:18 
AnswerRe: Sortable List Pin
led mike30-May-08 4:46
led mike30-May-08 4:46 
QuestionImplement a Cyber Coffe in C# Pin
hendryck30-May-08 4:09
hendryck30-May-08 4:09 
AnswerRe: Implement a Cyber Coffe in C# Pin
Colin Angus Mackay30-May-08 4:22
Colin Angus Mackay30-May-08 4:22 
QuestionCoverflow/Shift window switching effect Pin
bDreea30-May-08 4:03
bDreea30-May-08 4:03 
QuestionHELP HELP URGENTLY!!!! Pin
Wajeeha30-May-08 2:55
Wajeeha30-May-08 2:55 
this is my code. or part of it
{
:
:
this.sqlConnection1.ConnectionString = "workstation id=S6W6Q4;packet size=4096;integrated security=SSPI;data source=S6W6Q" +
"4;persist security info=True;initial catalog=master";
//
// sqlInsertCommand1
//
this.sqlInsertCommand1.CommandText = "INSERT INTO [\'List For Haj Ballot$\'] ([List For Haj Ballot 2008], F2, F3, F4, F5," +
" F6) VALUES (@Param1, @F2, @F3, @F4, @F5, @F6); SELECT [List For Haj Ballot 2008" +
"], F2, F3, F4, F5, F6 FROM [\'List For Haj Ballot$\']";
this.sqlInsertCommand1.Connection = this.sqlConnection1;
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Param1", System.Data.SqlDbType.Float, 8, "List For Haj Ballot 2008"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@F2", System.Data.SqlDbType.Float, 8, "F2"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@F3", System.Data.SqlDbType.NVarChar, 255, "F3"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@F4", System.Data.SqlDbType.NVarChar, 255, "F4"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@F5", System.Data.SqlDbType.NVarChar, 255, "F5"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@F6", System.Data.SqlDbType.NVarChar, 255, "F6"));
//
// sqlDataAdapter1
//
this.sqlDataAdapter1.InsertCommand = this.sqlInsertCommand1;
this.sqlDataAdapter1.SelectCommand = this.sqlSelectCommand1;
this.sqlDataAdapter1.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
new System.Data.Common.DataTableMapping("Table", "\'List For Haj Ballot$\'", new System.Data.Common.DataColumnMapping[] {
new System.Data.Common.DataColumnMapping("List For Haj Ballot 2008", "List For Haj Ballot 2008"),
new System.Data.Common.DataColumnMapping("F2", "F2"),
new System.Data.Common.DataColumnMapping("F3", "F3"),
new System.Data.Common.DataColumnMapping("F4", "F4"),
new System.Data.Common.DataColumnMapping("F5", "F5"),
new System.Data.Common.DataColumnMapping("F6", "F6")})});
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.BackColor = System.Drawing.Color.LimeGreen;
this.ClientSize = new System.Drawing.Size(686, 548);
this.Controls.Add(this.label8);
this.Controls.Add(this.textBox5);
this.Controls.Add(this.label7);
this.Controls.Add(this.textBox4);
this.Controls.Add(this.label6);
this.Controls.Add(this.textBox3);
this.Controls.Add(this.label5);
this.Controls.Add(this.button1);
this.Controls.Add(this.pictureBox1);
this.Controls.Add(this.textBox2);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.label4);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "Form1";
this.Text = "APL Haj Ballot System";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);

}
#endregion

/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
/*try
{
//SqlConnection dataConnection = new SqlConnection();
//dataConnection.ConnectionString = "Integrated Security=true; Initial Catalog=master; Data Source = s6w6q4";
//dataConnection.Open();
//MessageBox.Show("connected");
SqlCommand dataCommand = new SqlCommand();

}
catch(Exception e)
{
Console.WriteLine("An error occurred accessing the database:" + e.Message);
}*/
}
SqlConnection dataConnection = new SqlConnection();
SqlCommand dataCommand = new SqlCommand();
//SqlDataReader sdr = new SqlDataReader();

/*private void button1_Click(object sender, System.EventArgs e)
{
SqlConnection dataConnection = new SqlConnection();
SqlCommand dataCommand = new SqlCommand();
dataCommand.Connection = dataConnection;
dataConnection.ConnectionString = "Integrated Security=true; Initial Catalog=master; Data Source = s6w6q4";
dataConnection.Open();
//dataCommand.Connection = dataConnection;
//dataCommand.CommandText = "SELECT Emp#, Name, Designation, Department, Location FROM master";
dataCommand.CommandText = "select (@Emp#, @Name, @Designation, @Department, @Location)From master";
//textBox1.DataBindings.Add("Text", dataConnection.Database.s6w6q4.master,"s6w6q4.master.Emp#");
SqlDataReader datar = dataCommand.ExecuteReader();
while(datar.Read())
{
int empid = datar.GetInt32(1);
//textBox1.Text = Convert.ToString(empid);
string empname = datar.GetString(2);
string desig = datar.GetString(3);
string dept = datar.GetString(4);
string loc = datar.GetString(5);

}
}*/


private void Form1_Load(object sender, System.EventArgs e)
{
SqlConnection dataConnection = new SqlConnection();
dataConnection.ConnectionString = "Integrated Security=true; Initial Catalog=master; Data Source = s6w6q4";
dataConnection.Open();
MessageBox.Show("Connected");
}

private void button1_Click(object sender, System.EventArgs e)
{
DataTable tbl_master = new DataTable();

dataConnection.ConnectionString = "Integrated Security=true; Initial Catalog=master; Data Source = s6w6q4";
//SqlConnection conn_offers = new SqlConnection("Integrated Security=true; Initial Catalog=master; Data Source = s6w6q4");
SqlDataAdapter da_offers = new SqlDataAdapter("SELECT 1 * FROM tbl_offers master BY NewID()", dataConnection);
da_offers.Fill(tbl_master);
}
}
}

with commented stuff.
i've tried various methods as can be seen, but nothing is helping n the project is due sunday.
this is what i want. a data table, called master, has been connected with my project.
it is a list of employees, and a ballot has to take place for a promotion. if that name would be dismissed, the button would be pressed again to retrieve another name, excluding the one that was chosen before.
i want to display the various attributes of the employee in textboxes. i hav no idea wat is happening anymore, i've been on this project for a week, n i regret i dint come here earlier.
Cry | :(( im very very distressed. pls help me ASAP, pls get that code above right. n tel me how 2 kno if the connection is right.
as u can c, i've made the project so that as soon as the form loads, it tels me that a connection to database has been established. n it does so. but its not retrieving data. if i hav to display the data any other way, i will, but just help me outta this mess! Cry | :((
AnswerRe: HELP HELP URGENTLY!!!! Pin
Wajeeha30-May-08 3:09
Wajeeha30-May-08 3:09 
GeneralRe: HELP HELP URGENTLY!!!! Pin
subhankarbiswas30-May-08 9:00
subhankarbiswas30-May-08 9:00 
AnswerRe: HELP HELP URGENTLY!!!! Pin
Andy *M*30-May-08 3:17
Andy *M*30-May-08 3:17 
AnswerRe: HELP HELP URGENTLY!!!! PinPopular
Colin Angus Mackay30-May-08 3:25
Colin Angus Mackay30-May-08 3:25 
AnswerRe: HELP HELP URGENTLY!!!! PinPopular
Baconbutty30-May-08 3:37
Baconbutty30-May-08 3:37 
GeneralRe: HELP HELP URGENTLY!!!! Pin
eggsovereasy30-May-08 4:04
eggsovereasy30-May-08 4:04 
RantRe: HELP HELP URGENTLY!!!! Pin
blakey40430-May-08 4:27
blakey40430-May-08 4:27 
RantRe: HELP HELP URGENTLY!!!! Pin
blakey40430-May-08 4:27
blakey40430-May-08 4:27 
AnswerRe: HELP HELP URGENTLY!!!! Pin
Bert delaVega30-May-08 12:47
Bert delaVega30-May-08 12:47 
QuestionWorking with Decimals Pin
Jim Warburton30-May-08 2:47
Jim Warburton30-May-08 2:47 
AnswerRe: Working with Decimals Pin
Matthew Butler30-May-08 3:34
Matthew Butler30-May-08 3:34 
AnswerRe: Working with Decimals Pin
CPallini30-May-08 3:39
mveCPallini30-May-08 3:39 
GeneralRe: Working with Decimals Pin
Jim Warburton30-May-08 4:27
Jim Warburton30-May-08 4:27 
AnswerRe: Working with Decimals Pin
buchstaben30-May-08 3:40
buchstaben30-May-08 3:40 
GeneralRe: Working with Decimals Pin
Jim Warburton30-May-08 4:26
Jim Warburton30-May-08 4:26 
QuestionDotNet Remoting : Event Listner not working in Client App Pin
moobo30-May-08 2:40
moobo30-May-08 2:40 
AnswerRe: DotNet Remoting : Event Listner not working in Client App Pin
Bert delaVega30-May-08 4:47
Bert delaVega30-May-08 4: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.