我正在尝试制作一个房间请求程序,并有两个窗口,我需要连接到数据库(我知道怎么做)。这两个窗口分别称为紧急窗口和看门人窗口。我的问题是我不知道如何在数据库中存储信息。例如,假设某人作为紧急情况登录并发送请求,需要存储信息,一旦看门人登录,他就可以看到请求。到目前为止,我已经有了数据库,但不确定在不手动添加信息的情况下是否在其中存储信息。如果任何人有任何关于如何做到这一点的指南或链接,我将不胜感激!
紧急窗口代码:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace LOGINPAGE
{
public partial class EMERGENCY : Form
{
public EMERGENCY()
{
InitializeComponent();
}
void Fillcombo()
{
}
private void EMERGENCY_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'roomInfoDataSet6.Table' table. You can move, or remove it, as needed.
}
private void xButton1_Click(object sender, EventArgs e)
{
this.Close();
Application.Exit();
}
private void xButton2_Click(object sender, EventArgs e)
{
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void Search_Click(object sender, EventArgs e)
{
}
}
}
看门人代码:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace LOGINPAGE
{
public partial class JANITOR : Form
{
public JANITOR()
{
InitializeComponent();
}
private void label1_Click(object sender, EventArgs e)
{
}
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
}
private void JANITOR_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'roomInfoDataSet3.Table' table. You can move, or remove it, as needed.
this.tableTableAdapter.Fill(this.roomInfoDataSet3.Table);
}
private void xButton4_Click(object sender, EventArgs e)
{
}
private void xButton2_Click(object sender, EventArgs e)
{
this.Close();
Application.Exit();
}
}
}
发布于 2016-04-14 22:12:57
您可以使用Ms access db。
通过大量YouTube视频教程,您会发现从c#连接acess变得非常简单
我可以在it数据库中有一个由“保存紧急”按钮更新的表,而看门人的“加载紧急”按钮将用同一个表中的项填充数据网格视图,该表填充了第一个按钮。
https://stackoverflow.com/questions/36624877
复制相似问题