Connect C# application to SQL database

Create USER Login Application without user entering password; just the

Page 1 of 1

1 Replies - 1958 Views - Last Post: 21 November 2009 - 04:51 PM Rate Topic: -----

#1 PQE  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 21-November 09

Connect C# application to SQL database

Posted 21 November 2009 - 04:42 PM

protected void Button12_Click(object sender, EventArgs e)
		{
			string id;
			id = TextBox1.Text;
			SqlConnection tc = new SqlConnection("user id=XXXXXXX;" +
									   "password=XXXX;server=localhost;" +
									   "Trusted_Connection=yes;" +
									   "database=tc; " +
									   "connection timeout=0");
			
			SqlCommand command = new SqlCommand("StoredProcedure1",tc);
			command.CommandType = CommandType.StoredProcedure;
			

			
		}


//my procedure
ALTER PROCEDURE dbo.StoredProcedure1
	/*
	(
	@parameter1 int = 5,
	@parameter2 datatype OUTPUT
	)
	*/
	@time varchar(6)= XXXXX,
	@fac varchar (6) = XXXXX
AS 
	
	Insert INTO  timeInfo ( timeIN, facID) VALUES (@time, @fac) 

	
	

	/* SET NOCOUNT ON */
	RETURN



Admin Edit: Please use code tags when posting your code. Code tags are used like so => :code:

Thanks,
PsychoCoder :)

Is This A Good Question/Topic? 0
  • +

Replies To: Connect C# application to SQL database

#2 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1642
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: Connect C# application to SQL database

Posted 21 November 2009 - 04:51 PM

Are you receiving any errors? Does this code not work that way you intended it? When asking for help there are a couple items that are vital in order for someone to properly help you:
  • Post the code you're having problems with
  • Post the exact error you're receiving, if you are receiving one
  • If no error explain what the code is doing versus what you want it to do
  • Post your question in the body of your post, not the description field

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1