我想在Web服务上使用SQL,但我的错在哪里? [英] i want use SQL on Web service but where is my fault?

查看:128
本文介绍了我想在Web服务上使用SQL,但我的错在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法读取参数zyd,实际上是b。我怎么读这个?我找不到任何问题。但我认为有逻辑问题。我的SQL表 - > KullaniciAdi | Sifre

a | b

NULL | NULL

I can't read parameter "zyd" and actually "b" . How can I read this? I cant find any problem. But I think have logical problem. My SQL table--> KullaniciAdi | Sifre
a | b
NULL | NULL

static string zyd;
[WebMethod]
public void deneme()
{
    string b="a";
    string KullaniciAdi = "a";
    string connect = "Data Source=BERKAY-PC\\SQLEXPRESS;Initial Catalog=Hastahane;Integrated Security=True;";
    SqlConnection deneme = new SqlConnection(connect);
    SqlCommand komut = new SqlCommand("SELECT * FROM Giris where KullaniciAdi='" + KullaniciAdi + "'order by KullaniciAdi desc", deneme);

    try
    {
        deneme.Open();
        SqlDataReader oku = komut.ExecuteReader();
        while (oku.Read())
        {
            b = oku["Sifre"].ToString();
        }
    }
    finally
    {
        deneme.Close();
        komut.Dispose();
    }
    zyd=b;
}

推荐答案

您正在将KullaniciAdi排序为降序。验证KullaniciAdi ='a'的记录。
You are sorting KullaniciAdi to descending. Verify the records for KullaniciAdi ='a'.


已解决。 zyd = b是假的。 ZYD = b.tostring();是的。
Solved. "zyd=b" is false. "zyd=b.tostring();" is true.


这篇关于我想在Web服务上使用SQL,但我的错在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆