Click here to Skip to main content
15,891,431 members
Home / Discussions / C#
   

C#

 
GeneralWord plugin - working button Pin
Vodstok22-Apr-08 5:45
Vodstok22-Apr-08 5:45 
GeneralRe: Word plugin - working button Pin
Spacix One22-Apr-08 9:51
Spacix One22-Apr-08 9:51 
General"Remember my password" in a winforms application Pin
benjymous22-Apr-08 5:16
benjymous22-Apr-08 5:16 
GeneralRe: "Remember my password" in a winforms application Pin
led mike22-Apr-08 8:51
led mike22-Apr-08 8:51 
GeneralRe: "Remember my password" in a winforms application Pin
User 665822-Apr-08 8:59
User 665822-Apr-08 8:59 
General[Message Deleted] Pin
gottimukkala22-Apr-08 4:42
gottimukkala22-Apr-08 4:42 
GeneralRe: Wrong board Pin
Blue_Boy22-Apr-08 4:44
Blue_Boy22-Apr-08 4:44 
GeneralSqlParameter problem Pin
Deian22-Apr-08 3:53
Deian22-Apr-08 3:53 
Hello,

I have the following function, which is returning dataset from any of the desired identical databases. For some reason, I get exception "Must declare parameter @id"

public DataSet GetCustomerDevices(int nCustomerID, int nDatabaseID)<br />
        {<br />
            svcMSSQL mssql = new svcMSSQL();<br />
            DataSet dsDevices = new DataSet();<br />
<br />
            try<br />
            {<br />
                SqlConnection sqlConn = (SqlConnection)mssql.CreateConnection(clsConnStr.GetConnectionString());<br />
                <br />
                // get database details<br />
                string strDatabase = GetDatabaseName(nDatabaseID);<br />
<br />
                SqlCommand sqlCmd = (SqlCommand)mssql.CreateCommand("SELECT ColNo1, ColNo2, ColNo3 FROM "+strDatabase+".dbo.tblClientProc WHERE PartnerCode=@id ORDER BY ColNo1 ASC", sqlConn);<br />
                sqlCmd.Parameters.AddWithValue("@id", nCustomerID.ToString());<br />
                sqlCmd.Parameters["@id"].SqlDbType = SqlDbType.Int;<br />
<br />
                foreach (SqlParameter param in sqlCmd.Parameters)<br />
                {<br />
                    clsDebug.WriteString("Param name: " + param.ParameterName + ", Param Type: " +param.SqlDbType.ToString()+ ", value is: " + param.Value);<br />
                }<br />
<br />
                SqlDataAdapter sqlAdapter = (SqlDataAdapter)mssql.CreateDataAdapter(sqlCmd, sqlConn);<br />
                sqlAdapter.Fill(dsDevices);<br />
<br />
                sqlCmd.Dispose();<br />
                sqlAdapter.Dispose();<br />
                sqlConn.Dispose();<br />
            }<br />
            catch (Exception e)<br />
            {<br />
                clsDebug.ReportError(e.Message);<br />
            }<br />
            return dsDevices;<br />
        }<br />



Here is output of the clsDebug.WriteString function:

Method: GetCustomerDevices
File:
Line: 63
Msg: Param name: @id, Param Type: Int, value is: 2762

Any help is appreciated
GeneralRe: SqlParameter problem Pin
Blue_Boy22-Apr-08 4:00
Blue_Boy22-Apr-08 4:00 
GeneralRe: SqlParameter problem Pin
Deian22-Apr-08 4:14
Deian22-Apr-08 4:14 
GeneralRe: SqlParameter problem Pin
Blue_Boy22-Apr-08 4:26
Blue_Boy22-Apr-08 4:26 
GeneralRe: SqlParameter problem Pin
Deian22-Apr-08 4:27
Deian22-Apr-08 4:27 
GeneralRe: SqlParameter problem Pin
Blue_Boy22-Apr-08 4:33
Blue_Boy22-Apr-08 4:33 
GeneralRe: SqlParameter problem Pin
Colin Angus Mackay22-Apr-08 10:28
Colin Angus Mackay22-Apr-08 10:28 
GeneralRe: SqlParameter problem Pin
Colin Angus Mackay22-Apr-08 10:27
Colin Angus Mackay22-Apr-08 10:27 
GeneralRe: SqlParameter problem Pin
Deian22-Apr-08 20:34
Deian22-Apr-08 20:34 
GeneralRe: SqlParameter problem Pin
Colin Angus Mackay22-Apr-08 22:10
Colin Angus Mackay22-Apr-08 22:10 
GeneralRe: SqlParameter problem Pin
Deian22-Apr-08 22:30
Deian22-Apr-08 22:30 
QuestionDataGridView... Deleting/finding a row from/in the underlying DataSource (DataTable) Ideas anyone? Pin
blakey40422-Apr-08 3:45
blakey40422-Apr-08 3:45 
AnswerRe: DataGridView... Deleting/finding a row from/in the underlying DataSource (DataTable) Ideas anyone? Pin
Blue_Boy22-Apr-08 4:40
Blue_Boy22-Apr-08 4:40 
GeneralRe: DataGridView... Deleting/finding a row from/in the underlying DataSource (DataTable) Ideas anyone? Pin
blakey40422-Apr-08 4:59
blakey40422-Apr-08 4:59 
GeneralSolution for anyone interested... Pin
blakey40422-Apr-08 5:06
blakey40422-Apr-08 5:06 
QuestionThreadStart issue Pin
merh22-Apr-08 3:45
merh22-Apr-08 3:45 
GeneralRe: ThreadStart issue Pin
Spacix One22-Apr-08 3:47
Spacix One22-Apr-08 3:47 
GeneralRe: ThreadStart issue Pin
merh22-Apr-08 3:56
merh22-Apr-08 3:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.