SqlCommand not accepting SqlParameter Programming Web Development by Schol-R-LEA … conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ServicePro"].ConnectionString); SqlCommand command = new SqlCommand("SetClientEmail", conn); command.CommandType = CommandType.StoredProcedure; SqlParameter… Re: SqlCommand not accepting SqlParameter Programming Web Development by Schol-R-LEA … the parameters do show up (apparently correctly) in the [ICODE]SQlCommand[/ICODE] object when I watch it in the debugger, and… Re: SqlCommand not accepting SqlParameter Programming Web Development by Schol-R-LEA … parameter in question is in fact being added to the SqlCommand. I don't see how using an array would make… Hashtables function not working with SqlCommand parameters? Programming Software Development by kolibrizas [CODE]SqlCommand command = new SqlCommand("SELECT Id FROM users WHERE Username=@Username AND…pieces[2]);[/CODE] doesn't return correct result [CODE]SqlCommand command = new SqlCommand("SELECT Id FROM users WHERE Username=@Username AND…] Maybe there is a way to check how the SqlCommand looks once with parameters added or other way to check… Re: Help with SqlCommand Programming Software Development by Gospp …SqlConnection connection = new SqlConnection(Settings.Default.ConnectionString); SqlCommand command = new SqlCommand(sql, connection); if (args != null) command…Append(","); } } sb.Append(SqlStrSelectTimePart2); SqlCommand SqlCmd = new SqlCommand(); SqlCmd.CommandText = sb.ToString(); SqlCmd.Parameters.Add… Help with SqlCommand Programming Software Development by Gospp … problem when trying to convert my sql-query to a SqlCommand. The query: [CODE] SELECT L1.[App_Name], DATEDIFF(ss,MAX(L1… the query via a config-file. [CODE]private SqlCommand CreateSQLCommand(int i) { SqlCommand SqlCmd = new SqlCommand(); //SqlCmd.CommandText = SqlStrSelectTime; SqlCmd.CommandText = "SELECT… Re: Help with SqlCommand Programming Software Development by Gospp … don't get a query response. :( [CODE]private SqlCommand CreateSQLCommand(int i) { SqlCommand SqlCmd = new SqlCommand(); //SqlCmd.CommandText = SqlStrSelectTime; SqlCmd.CommandText = "SELECT… Re: Help with SqlCommand Programming Software Development by privatevoid … SqlParameter[] args) { SqlConnection connection = new SqlConnection(Settings.Default.ConnectionString); SqlCommand command = new SqlCommand(sql, connection); if (args != null) command.Parameters.AddRange(args… passing empty string to SqlCommand.Parameter.Add Programming Software Development by baba0880 …,engDesc,frDesc) VALUES (@key,@english,@french)" Dim cmd As SqlCommand = SqlConnection1.CreateCommand cmd.Parameters.Add("@key", txtKey.Text… Going to new line (sqlcommand class)_ Programming Software Development by castajiz_2 cmd = new SqlCommand ("select beggining_school, end_school FROM Student,student_weekend,Weekend WHERE Student.… Re: SqlCommand not accepting SqlParameter Programming Web Development by stbuchok Have you tried running the stored procedure in SSMS (SQL Server Management Studio) to see if it is the stored procedure? Re: SqlCommand not accepting SqlParameter Programming Web Development by aspproject you missed writing number of parameters ... write code like SqlParameter[] ISqlPara = new SqlParameter[2]; ISqlPara[0] = new SqlParameter("@NewsID", NewsID); ISqlPara[1] = new SqlParameter("@newsname", Newsname); Re: SqlCommand not accepting SqlParameter Programming Web Development by NETProgrammer You can try something like this [CODE]command.Parameters.Add("@AccountKey", SqlDbType.Int).Value = accountKey;[/CODE] Repeat this for all of your parameters. Database attempt to retrieve all column name Programming Web Development by gahhon SqlCommand cmdColumnName = new SqlCommand("SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='DailyBudget' ORDER … Re: Hashtables function not working with SqlCommand parameters? Programming Software Development by thines01 Do you need to cast the return value from the Hastable as a string, first (like pieces[1].ToString())? Can you use a Dictionary<int, string> instead? Re: Hashtables function not working with SqlCommand parameters? Programming Software Development by kolibrizas I did solve this myself, the problem being wrong base encoding, not the problem in my code itself. Can I delete this topic somehow? Re: Help with SqlCommand Programming Software Development by Sodabread I'm not 100% on this, but shouldn't your inAppId variable be a stringbuilder or something similar? Right now, you're trying to add a List as a varchar and I didn't think that would implicitly convert correctly. Re: Help with SqlCommand Programming Software Development by Sodabread Hmm. When you return that SQL command, are you associating it with a connection object? Also, how are you executing the query? Re: Help with SqlCommand Programming Software Development by Gospp [QUOTE=Sodabread;1194359]Hmm. When you return that SQL command, are you associating it with a connection object? Also, how are you executing the query?[/QUOTE] Yes I do, if I remove the "in" part of the query everything works fine... [CODE]sqlcmd.Connection = SQLConnection; SqlDataAdapter SQLDataAdapter = new SqlDataAdapter(sqlcmd… Re: Help with SqlCommand Programming Software Development by Sodabread Let's try this. When you create your stringbuilder, you immediately append a double apostrophe and then a comma. I'm wondering if an empty set of apostrophes is causing issues. For curiosity's sake, try this: [CODE] StringBuilder inAppId = new StringBuilder(); for(int j = 0; j < ServiceList.Count; j++) { inAppId.Append("'" + … Re: Help with SqlCommand Programming Software Development by Gospp [QUOTE=Sodabread;1194614]Let's try this. When you create your stringbuilder, you immediately append a double apostrophe and then a comma. I'm wondering if an empty set of apostrophes is causing issues. For curiosity's sake, try this: [CODE] StringBuilder inAppId = new StringBuilder(); for(int j = 0; j < ServiceList.Count; j++) { … Re: Help with SqlCommand Programming Software Development by privatevoid Thats fine aslong as the app_names are not editable outside the code as this will leave a security vulnerability. Re: Help with SqlCommand Programming Software Development by Gospp [QUOTE=privatevoid;1195260]Thats fine aslong as the app_names are not editable outside the code as this will leave a security vulnerability.[/QUOTE] I fetch them from a database, so they should be safe. Re: Help with SqlCommand Programming Software Development by Sodabread Good catch, void. I think I need to up my C# knowledge a bit. Re: Help with SqlCommand Programming Software Development by Gospp I think we've come as far as we are going to get. Thanks for your help, both of you!! :) Re: passing empty string to SqlCommand.Parameter.Add Programming Software Development by baba0880 Error Message Prepared statement '(@key char(10),@english char(40),@french char(40)) INSERT expects parameter @english,which was not supplied Re: passing empty string to SqlCommand.Parameter.Add Programming Software Development by baba0880 cmd.Parameters.Add("@key", SqlDbType.Char).Value = IIf(txtKey.Text = String.Empty, DBNull.Value, txtKey.Text) Re: Going to new line (sqlcommand class)_ Programming Software Development by deceptikon Two options. One is a verbatim string: var query = @"select beggining_school, end_school FROM Student,student_weekend,Weekend WHERE Student.ID=student_weekend.studentID AND student_weekend.WeekendID=Weekend.ID" Note that indentation is significant in the string, as are newlines. The other, my preference, is literal … Re: Database Update Failure. Programming Web Development by gahhon SqlCommand cmdUpdateTransaction = new SqlCommand(String.Format("UPDATE DailyBudget SET {0}=@amount WHERE (Username=@username AND Date=@date)", txtCategory.Text), conAddTransaction); is said my `=` got problem. Please advise me. Thanks a lot. Re: Dispose in asp.net Programming Software Development by Ramy Mahrous SqlCommand inherits from DBCommand which inherits from Component Component has this …