Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQLParameter converting to integer
Message
 
 
À
24/06/2008 05:05:51
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
C# 3.0
OS:
Windows XP
Database:
MS SQL Server
Divers
Thread ID:
01326205
Message ID:
01326319
Vues:
18
>It's already implicitly casted, no? You may specify the type in constructor or via properties too.
>Cetin

Not sure what you're suggesting, Cetin. I had to use Convert class, but I'm not sure if I'm correct. Here is what I did:
SqlParameter[] parameters = new SqlParameter[5];
                        parameters[0] = new SqlParameter("RegistrationID", RegID);
                        parameters[1] = new SqlParameter("PersonID", SqlDbType.Int);
                        parameters[1].Direction = ParameterDirection.Output ;
                        parameters[2] = new SqlParameter("FirstName", SqlDbType.VarChar, 25);
                        parameters[2].Direction = ParameterDirection.Output;
                        parameters[3] = new SqlParameter("LastName", SqlDbType.VarChar, 30);
                        parameters[3].Direction = ParameterDirection.Output;
                        parameters[4] = new SqlParameter("Email", SqlDbType.VarChar, 75);
                        parameters[4].Direction = ParameterDirection.Output;   

                        //new System.Data.SqlClient.SqlParameter("RegistrationID", RegID)
                        Util.RunStoredProc("SaveApprovedPerson", parameters);
                        PersonName = parameters[2].Value + " " + parameters[3].Value;  // Here is the implicit cast
                        MessageText = "Dear " + PersonName + ", " +
                                      Environment.NewLine + Environment.NewLine + "Your Registration has been approved! " +
                                      Environment.NewLine + Environment.NewLine + "Welcome to ...!";
                        // Here we need explicit cast ?
                        Util.SendMessage(parameters[4].Value.ToString(), Convert.ToInt32(parameters[1].Value), Membership.GetUser(),
                        false, MessageText, "Registration Approved", System.Configuration.ConfigurationManager.AppSettings["devEmail"],null,null );
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform