----------------------------------------------------------- New Message on MumbaiUserGroup
----------------------------------------------------------- From: TribalTechnology Message 2 in Discussion Hi Dilip, When cmd.ExecuteNonQuery(); is executed, the following sql statement is fired off - exec sp_executesql "use master CREATE LOGIN [EMAIL PROTECTED] WITH PASSWORD=N'@p_Password' , DEFAULT_DATABASE=[master], CHECK_EXPIRATION=OFF, CHECK_POLICY=ON","@p_Login varchar(30),@p_Password varchar(30)",@p_Login='XYZ',@p_Password='pass' So the parameters are treated as SQL variables and the same rules apply. A variable cant be treated as an identifier. For e.g I cant do this - declare @tablename varchar(30) Set @tablename = "testtable" Create table @tablename ( code int not null, empname varchar(20) null) In your case you will need to build the String in your c# code inside CreateDBLogin method as - string SQL_CREATE_LOGIN = @"use master CREATE LOGIN [" + login + @"] WITH [EMAIL PROTECTED] , DEFAULT_DATABASE=[master], CHECK_EXPIRATION=OFF, CHECK_POLICY=ON"; password can still be passed in as a parameter if you remove the quotes around it as shown above. Hope this helps. ----------------------------------------------------------- To stop getting this e-mail, or change how often it arrives, go to your E-mail Settings. http://groups.msn.com/MumbaiUserGroup/_emailsettings.msnw Need help? If you've forgotten your password, please go to Passport Member Services. http://groups.msn.com/_passportredir.msnw?ppmprop=help For other questions or feedback, go to our Contact Us page. http://groups.msn.com/contact If you do not want to receive future e-mail from this MSN group, or if you received this message by mistake, please click the "Remove" link below. On the pre-addressed e-mail message that opens, simply click "Send". Your e-mail address will be deleted from this group's mailing list. mailto:[EMAIL PROTECTED]
