Click here to Skip to main content
15,896,504 members
Home / Discussions / Database
   

Database

 
QuestionRe: SQL code coverage Pin
Chris Meech16-Nov-05 9:10
Chris Meech16-Nov-05 9:10 
AnswerRe: SQL code coverage Pin
Paul Watson16-Nov-05 9:22
sitebuilderPaul Watson16-Nov-05 9:22 
QuestionTying a XML playlist to SQL data Pin
normschaef15-Nov-05 11:56
normschaef15-Nov-05 11:56 
Questionschema design question Pin
ppp00115-Nov-05 6:44
ppp00115-Nov-05 6:44 
AnswerRe: schema design question Pin
Daniel Santillanes15-Nov-05 7:00
professionalDaniel Santillanes15-Nov-05 7:00 
GeneralRe: schema design question Pin
toxcct16-Nov-05 5:24
toxcct16-Nov-05 5:24 
QuestionDataSet - Query problem Pin
Timothy_198215-Nov-05 5:47
Timothy_198215-Nov-05 5:47 
AnswerRe: DataSet - Query problem Pin
Daniel Santillanes15-Nov-05 6:49
professionalDaniel Santillanes15-Nov-05 6:49 
GeneralRe: DataSet - Query problem Pin
Timothy_198215-Nov-05 7:36
Timothy_198215-Nov-05 7:36 
GeneralRe: DataSet - Query problem Pin
Daniel Santillanes15-Nov-05 12:18
professionalDaniel Santillanes15-Nov-05 12:18 
QuestionNo Row Returned Pin
Brendan Vogt14-Nov-05 17:43
Brendan Vogt14-Nov-05 17:43 
AnswerRe: No Row Returned Pin
Colin Angus Mackay14-Nov-05 20:21
Colin Angus Mackay14-Nov-05 20:21 
Questionconnecting to a database..needs help Pin
JustmeNick14-Nov-05 5:52
JustmeNick14-Nov-05 5:52 
QuestionSQL Server does not exist or access denied. Pin
smita_roy13-Nov-05 21:30
smita_roy13-Nov-05 21:30 
AnswerRe: SQL Server does not exist or access denied. Pin
ricardojb14-Nov-05 17:20
ricardojb14-Nov-05 17:20 
QuestionInternal Processor Error Pin
lovelylooney13-Nov-05 21:26
lovelylooney13-Nov-05 21:26 
Questiondiff b/w ado and ado.net Pin
expertdeveloper13-Nov-05 20:18
expertdeveloper13-Nov-05 20:18 
AnswerRe: diff b/w ado and ado.net Pin
toxcct16-Nov-05 5:31
toxcct16-Nov-05 5:31 
Questionproblem with Sqlparameters :( Pin
da vinci coder13-Nov-05 13:09
da vinci coder13-Nov-05 13:09 
hi guys..

can anyone tell me what might be the error at the following code ?

public void getCounterValue(string countername,string tablename,string email)
{


SqlConnection conn = null;
SqlDataReader reader = null;

int result = 0;

try
{

conn = new SqlConnection("Server=(local);Integrated security=SSPI;database=halkdanis");
conn.Open();
SqlCommand cmd = new SqlCommand("select @ctr from @table where @mail = @mail", conn);

SqlParameter param = new SqlParameter();
param.ParameterName = "@ctr";
param.Value = countername;

SqlParameter param2 = new SqlParameter();
param2.ParameterName = "@table";
param2.Value = tablename;

SqlParameter param3 = new SqlParameter();
param3.ParameterName = "@mail";
param3.Value = email;


cmd.Parameters.Add(param);
cmd.Parameters.Add(param2);
cmd.Parameters.Add(param3);


reader = cmd.ExecuteReader();


while(reader.Read())
{
result = Convert.ToInt32(reader[0]);
}
}

catch(Exception x)
{
MessageBox.Show(x.ToString());
}
finally
{
reader.Close();
conn.Close();

}

}

it throws the exception @table doesn`t have a value,

but it has the value tablename from the method construction..

any thougts ?

thx !
good coding !
AnswerRe: problem with Sqlparameters :( Pin
Colin Angus Mackay13-Nov-05 13:21
Colin Angus Mackay13-Nov-05 13:21 
GeneralRe: problem with Sqlparameters :( Pin
TheJudeDude9-Feb-06 6:16
TheJudeDude9-Feb-06 6:16 
GeneralRe: problem with Sqlparameters :( Pin
Colin Angus Mackay9-Feb-06 7:18
Colin Angus Mackay9-Feb-06 7:18 
GeneralRe: problem with Sqlparameters :( Pin
TheJudeDude9-Feb-06 9:08
TheJudeDude9-Feb-06 9:08 
GeneralRe: problem with Sqlparameters :( Pin
Colin Angus Mackay9-Feb-06 14:18
Colin Angus Mackay9-Feb-06 14:18 
GeneralRe: problem with Sqlparameters :( Pin
TheJudeDude9-Feb-06 14:27
TheJudeDude9-Feb-06 14:27 

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.