1 Replies - 1398 Views - Last Post: 24 September 2006 - 09:14 AM Rate Topic: -----

#1 Mrafcho001  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 41
  • View blog
  • Posts: 769
  • Joined: 01-November 05

Connecting to SQL server

Posted 23 September 2006 - 07:44 PM

Ok for the past 30 mins i've been trying to figure out why this wont work..

I have an ASP.NET application which is suppose to connect to an application and add some data. But it wont let me.. it keeps spitting out log in failed errors at me.

What is my Connection String suppose to be like? I pretty much have no idea wut im doing.

here is a small piece of code.

SqlConnection conn = new SqlConnection(SqlDataSource1.ConnectionString);
	string cmdInsert = "INSERT INTO table1";
	SqlCommand cmd = new SqlCommand(cmdInsert, conn);
	cmd.Parameters.AddWithValue("@Name", TextBox1.Text);
	cmd.Parameters.AddWithValue("@Number", TextBox2.Text);

	conn.Open();
	cmd.ExecuteNonQuery();
	conn.Close();


Thanks.

Is This A Good Question/Topic? 0
  • +

Replies To: Connecting to SQL server

#2 Jayman  Icon User is offline

  • Student of Life
  • member icon

Reputation: 418
  • View blog
  • Posts: 9,532
  • Joined: 26-December 05

Re: Connecting to SQL server

Posted 24 September 2006 - 09:14 AM

You can find connection strings here.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1