hi all,
[EDIT] I am using sql server 2005
i am having trouble executing the sp_databases stored procedure from my app... i am creating an sqlcommand and assigning the relevant value to their properties...
one thing i have noticed is that if i use integrated security=true in the connectionstring it works no problem, however if i add a user to the master database with a password and try using the username and password from my application, it doesnt work!! can anyone explain why i cant execute sp_databases with sql authentication?
here is my code so far
here is the connection creation:Code:SqlCommand cmd = new SqlCommand(); cmd.CommandText = "sp_databases"; cmd.CommandType = CommandType.StoredProcedure; cmd.Connection = cf.masterCnn(); ds = cf.getDbs(cmd); foreach (DataRow r in ds.Tables[0].Rows) { cboDatabase.Items.Add(r[0].ToString()); }
Code:public SqlConnection masterCnn() //this is responsible for instanciating the connection { master = masterString(); cnn = new SqlConnection(master); return cnn; }if anyone could shed some light on this, i would be really gratefulCode:private string masterString() //this creates the connection string { string c; c = "server=" + server + ";initial catalog=master;Connect Timeout=10;user id=" + username + ";password=" + password + ";Trusted_connection=false"; return c; }
thanks
adam





Reply With Quote