Quantcast
Channel: Visual Studio and Visual Web Developer Express
Viewing all articles
Browse latest Browse all 3509

trouble with my SQL

$
0
0

Hi guys,

Can one of you giude in the right direction? I don't understand why this is not working.

                SqlCommand comm = new SqlCommand("SELECT tbInterestsUtilisateur.interestsID FROM tbInterestsUtilisateur INNER JOIN tbUtilisateur ON tbInterestsUtilisateur.userID = tbUtilisateur.userID WHERE  (tbUtilisateur.userName = '@username')", con);

                SqlParameter param = new SqlParameter();
                param.ParameterName = "@username";
                param.Value = "rimo72";
                comm.Parameters.Add(param);

                SqlDataReader reader = comm.ExecuteReader();


the "reader" variable is always empty.

If I put the value directly in my query, "reader" is populated.

What am I doing wrong?

 

Thanks


Viewing all articles
Browse latest Browse all 3509

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>