ExecuteScalar() 공개 메소드

public ExecuteScalar ( ) : object
리턴 object
예제 #1
0
        public void Insert()
        {
            var cmd = new SqlCommand("INSERT INTO rohbot.notifications (userid, regex, devicetoken) VALUES(:userid, :regex, :devicetoken) RETURNING id;");
            cmd["userid"] = UserId;
            cmd["regex"] = Regex.ToString();
            cmd["devicetoken"] = DeviceToken;

            Id = (long)cmd.ExecuteScalar();
        }
예제 #2
0
        public override void Insert()
        {
            if (Id != 0)
                throw new InvalidOperationException("Cannot insert existing row");

            var cmd = new SqlCommand("INSERT INTO rohbot.chathistory (type,date,chat,content,usertype,sender,senderid,senderstyle,ingame)" +
                                     "VALUES (:type,:date,:chat,:content,:usertype,:sender,:senderid,:senderstyle,:ingame) RETURNING id;");
            cmd["type"] = Type;
            cmd["date"] = Date;
            cmd["chat"] = Chat;
            cmd["content"] = Content;
            cmd["usertype"] = UserType;
            cmd["sender"] = Sender;
            cmd["senderid"] = SenderId;
            cmd["senderstyle"] = SenderStyle;
            cmd["ingame"] = InGame;
            Id = (long)cmd.ExecuteScalar();
        }
예제 #3
0
        public override void Insert()
        {
            if (Id != 0)
                throw new InvalidOperationException("Cannot insert existing row");

            var cmd = new SqlCommand("INSERT INTO rohbot.chathistory (type,date,chat,content,state,\"for\",forid,fortype,forstyle,by,byid,bytype,bystyle)" +
                                     "VALUES (:type,:date,:chat,:content,:state,:for,:forid,:fortype,:forstyle,:by,:byid,:bytype,:bystyle) RETURNING id;");
            cmd["type"] = Type;
            cmd["date"] = Date;
            cmd["chat"] = Chat;
            cmd["content"] = Content;
            cmd["state"] = State;
            cmd["for"] = For;
            cmd["forid"] = ForId;
            cmd["fortype"] = ForType;
            cmd["forstyle"] = ForStyle;
            cmd["by"] = By;
            cmd["byid"] = ById;
            cmd["bytype"] = ByType;
            cmd["bystyle"] = ByStyle;
            Id = (long)cmd.ExecuteScalar();
        }