RError.com

RError.com Logo RError.com Logo

RError.com Navigation

  • 主页

Mobile menu

Close
  • 主页
  • 系统&网络
    • 热门问题
    • 最新问题
    • 标签
  • Ubuntu
    • 热门问题
    • 最新问题
    • 标签
  • 帮助
主页 / user-326839

Дмитрий's questions

Martin Hope
Дмитрий
Asked: 2022-07-18 19:50:28 +0000 UTC

UWP 和 Android 的共享数据库

  • 0

我最近开始学习 Xamarin 并编写一个小型应用程序。并且出现了以下问题:UWP 和 Android 的应用程序使用不同的数据库。我怎样才能为所有平台建立一个共同的基础?

public class NoteDatabase
{
    readonly SQLiteAsyncConnection database;

    public NoteDatabase(string dPath)
    {
        database = new SQLiteAsyncConnection(dPath);
        database.CreateTableAsync<Note>().Wait();
    }

    public Task<List<Note>> GetNotesAsync()
    {
        return database.Table<Note>().ToListAsync();
    }

    public Task<Note> GetNoteAsync(int id)
    {
        return database.Table<Note>().Where(i => i.ID == id).FirstOrDefaultAsync();
    }

    public Task<int> SaveNoteAsync(Note note)
    {
        if (note.ID != 0)
        {
            return database.UpdateAsync(note);
        }    
        else
        {
            return database.InsertAsync(note);
        }
    }

    public Task<int> DeleteNoteAsync(Note note)
    {
        return database.DeleteAsync(note);
    }
}
c#
  • 1 个回答
  • 10 Views
Martin Hope
Дмитрий
Asked: 2020-05-30 20:13:44 +0000 UTC

运算符之间不使用 T-SQL 日期

  • 0

面临以下问题。我需要在 datagridview 中显示从一个日期到另一个日期的所有付款(如屏幕截图所示)。数据库中有一笔付款,日期为 2020 年 5 月 30 日,仅当两个 dateTimePickers 都包含此日期时,它才会显示在 DGV 中,在所有其他情况下,它仍为空。有人可以解释问题是什么并帮助解决请求以使一切正常吗?

在此处输入图像描述

表中的 BillDate 字段是日期类型。

    private void btnViewBills_Click(object sender, EventArgs e)
                {
DateTime fromDate = DateTime.Parse(dtpFromDate.Text);
DateTime toDate = DateTime.Parse(dtpToDate.Text);
con.Open();
dt = new DataTable();
adapt = new SqlDataAdapter("select * from BillInfo where BillDate between '" + fromDate + "' and '" + toDate + "'", con);
adapt.Fill(dt);
billInfoDataGridView.DataSource = dt;
con.Close();
                }
c#
  • 1 个回答
  • 10 Views
Martin Hope
Дмитрий
Asked: 2020-05-27 17:34:56 +0000 UTC

在另一台计算机上安装程序后建立与 SQL Server 的连接时出错

  • 0

我需要帮助解决一个问题。我使用MS Visual Studio Installer Projects创建了一个应用程序安装程序并在另一台设备上启动它,在加载sql localdb时,我首先收到此错误“安装程序检测到文件自最初发布以来已更改”,搜索互联网没有找到一个正常的解决方案并手动安装了 MS SQL Server 2017 LocalDB。之后,在启动程序时,我收到以下错误:

在此处输入图像描述

谁能建议如何解决它?

sql-server
  • 1 个回答
  • 10 Views
Martin Hope
Дмитрий
Asked: 2020-05-13 03:51:48 +0000 UTC

更新 DataGridView 时,错误值对于 Int32 来说太大或太小

  • 2

我遇到了以下问题:将有关产品的信息写入表格时没有错误,从当前表格切换到另一个表格并再次返回时没有错误。但是,关闭程序并重新启动后,当我打开表单添加产品时,updateProducts 函数中出现错误(它在Form_load 中调用,以及在将产品信息写入数据库的函数中调用)。Barcode 字段的类型是 nvarchar(50),所以我无法弄清楚错误中的 Int32 来自哪里。还是在datagridview中显示值有问题?那为什么,在写入数据之后和关闭程序之前,我可以安全地从一个窗体切换到另一个窗体,从而调用相同的 updateProducts 函数而不会出错。有人会告诉吗?PS:如果错误是表面上的,我提前道歉,我最近开始熟悉这种语言,

错误文本

错误

产品表

桌子

c#
  • 1 个回答
  • 10 Views
Martin Hope
Дмитрий
Asked: 2020-04-10 03:10:38 +0000 UTC

使用数据库表中的数据填充 Combobox,具体取决于在另一个 Combobox 中选择的值

  • 1

我需要帮助解决一个小问题。我自己已经尝试了很多东西,但没有成功(我正在为课程作业编写程序(为酒店经理)。我有一个带有 room_id 和 room_type 字段的 Rooms 表,我需要所有 id来自具有这种类型的 Rooms 表的房间(例如,Single。我希望我能清楚地解释它。下面是将数据加载到组合框的代码(来自 form_load)。

在此处输入图像描述

// loading data to combobox3
DataTable Rooms = new DataTable();
using (SqlConnection coon = new SqlConnection(conString))
{
    SqlCommand cmd = new SqlCommand();
    cmd.Connection = coon;
    cmd.CommandText = "select room_type from Rooms where reservation_id = 0";
    SqlDataAdapter adapter = new SqlDataAdapter(cmd);
    adapter.Fill(Rooms);
}

for (int i = 0; i < Rooms.Rows.Count; i++)
{
    comboBox3.Items.Add(Rooms.Rows[i]["room_type"]);
}

// loading data to combobox2
using (SqlConnection coon = new SqlConnection(conString))
{
    SqlCommand cmd = new SqlCommand();
    cmd.Connection = coon;
    cmd.CommandText = "select froom_id from Rooms where reservation_id = 0"
    SqlDataAdapter adapter = new SqlDataAdapter(cmd);
    adapter.Fill(Rooms);
}

for (int i = 0; i < Rooms.Rows.Count; i++)
{
    comboBox2.Items.Add(Rooms.Rows[i]["froom_id"]);
}

我试图做这样的事情,但是为了更新带有 room_id 的组合框中的数据,您需要更新表单,然后重置带有 room_type 的组合框中的值,我尝试保存它并替换再次加载表单后,它没有任何反应。有人可以建议如何做到这一点吗?

cmd.CommandText = "select froom_id from Rooms where reservation_id = 0 AND room_type = " + "'" + comboBox3.Text + "'";
c#
  • 1 个回答
  • 10 Views
Martin Hope
Дмитрий
Asked: 2020-03-22 03:45:26 +0000 UTC

将字符串转换为日期时间

  • 2

你能告诉我如何将字符串转换21.03.2020为类型DateTime吗?我尝试过这种方式,但出现错误。

string date = "21.03.2020";

DateTime date2 = DateTime.ParseExact(date, "dd/MM/yyyy", null);
c#
  • 1 个回答
  • 10 Views
Martin Hope
Дмитрий
Asked: 2020-03-20 01:28:56 +0000 UTC

将基于数组的双向链表拆分为 2 部分

  • 0

写完这段代码很困难,因为我最近开始学习 C++。我需要将用户设置的列表按元素的值分成两部分。例如,有一个列表“3 6 1 33 -4”,用户选择一个单元,得到2个新的列表“3 6 1”和“33 -4”,类似这样。没有想法。有人能帮忙吗?

#include <stdio.h>
#include <iostream>
#include <stdlib.h>

using namespace std;

#define MAX 50

int main(void)
{
    int list[MAX];
    int next[MAX];
    int prev[MAX];
    int end = 0;
    int begin = 0;

    for (int i = 0; i < MAX; i++)
    {
        list[i] = next[i] = prev[i] = 0;
    }

    cout << "Input the number of elements: ";
    int n = 0;
    cin >> n;
    prev[0] = -1;
    cout << "Input elements of list: ";
    int count = 0;

    for (int i = 0; i < n; i++)
    {
        cin >> list[i];
        next[i] = i + 1;
        prev[i] = i - 1;
        count++;
    }

    prev[0] = -1;
    next[count] = -1;
    begin = 0;
    end = count - 1;
    cout << "Elements of list: ";
    int temp = begin;

    do {
        printf("%d ", list[temp]);
        temp = next[temp];
    } while (next[temp] < n);

    cout << list[temp] << endl;
    system("pause");

    return 0;
}
c++
  • 1 个回答
  • 10 Views

Sidebar

Stats

  • 问题 10021
  • Answers 30001
  • 最佳答案 8000
  • 用户 6900
  • 常问
  • 回答
  • Marko Smith

    我看不懂措辞

    • 1 个回答
  • Marko Smith

    请求的模块“del”不提供名为“default”的导出

    • 3 个回答
  • Marko Smith

    "!+tab" 在 HTML 的 vs 代码中不起作用

    • 5 个回答
  • Marko Smith

    我正在尝试解决“猜词”的问题。Python

    • 2 个回答
  • Marko Smith

    可以使用哪些命令将当前指针移动到指定的提交而不更改工作目录中的文件?

    • 1 个回答
  • Marko Smith

    Python解析野莓

    • 1 个回答
  • Marko Smith

    问题:“警告:检查最新版本的 pip 时出错。”

    • 2 个回答
  • Marko Smith

    帮助编写一个用值填充变量的循环。解决这个问题

    • 2 个回答
  • Marko Smith

    尽管依赖数组为空,但在渲染上调用了 2 次 useEffect

    • 2 个回答
  • Marko Smith

    数据不通过 Telegram.WebApp.sendData 发送

    • 1 个回答
  • Martin Hope
    Alexandr_TT 2020年新年大赛! 2020-12-20 18:20:21 +0000 UTC
  • Martin Hope
    Alexandr_TT 圣诞树动画 2020-12-23 00:38:08 +0000 UTC
  • Martin Hope
    Air 究竟是什么标识了网站访问者? 2020-11-03 15:49:20 +0000 UTC
  • Martin Hope
    Qwertiy 号码显示 9223372036854775807 2020-07-11 18:16:49 +0000 UTC
  • Martin Hope
    user216109 如何为黑客设下陷阱,或充分击退攻击? 2020-05-10 02:22:52 +0000 UTC
  • Martin Hope
    Qwertiy 并变成3个无穷大 2020-11-06 07:15:57 +0000 UTC
  • Martin Hope
    koks_rs 什么是样板代码? 2020-10-27 15:43:19 +0000 UTC
  • Martin Hope
    Sirop4ik 向 git 提交发布的正确方法是什么? 2020-10-05 00:02:00 +0000 UTC
  • Martin Hope
    faoxis 为什么在这么多示例中函数都称为 foo? 2020-08-15 04:42:49 +0000 UTC
  • Martin Hope
    Pavel Mayorov 如何从事件或回调函数中返回值?或者至少等他们完成。 2020-08-11 16:49:28 +0000 UTC

热门标签

javascript python java php c# c++ html android jquery mysql

Explore

  • 主页
  • 问题
    • 热门问题
    • 最新问题
  • 标签
  • 帮助

Footer

RError.com

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

帮助

© 2023 RError.com All Rights Reserve   沪ICP备12040472号-5