用c#怎么讲从串口读出来的数据存入SQL SERVER数据库

发布于2022-01-13 04:03:40
8个回答
admin
网友回答2022-01-13
就是 ,你已经可以把串口的数据,读取出来了是吧?
如果是的话,那你就连接数据库,然后把你读取出来的信息,写入数据库就可以了。
比如,你从串口读取到的信息,用一个变量,比如A来表示,就是A=串口信息,
然后你建立数据库连接,接着,你把A写入数据库。
具体你最好先看下,C#怎么操作数据库。
admin
网友回答2022-01-13
楼主应该仔细看下c#如何操作数据库的,这个不难的。
admin
网友回答2022-01-13
sql server 数据库的扩展名是 . mdf,至于用什么软件能读出来我好像还没遇见,你试试 万能数据库读取 工具吧
admin
网友回答2022-01-13
设置itemindex
admin
网友回答2022-01-13
SELECT
Sysobjects.name AS [表],
syscolumns.name AS [列名],
systypes.name AS [数据类型],
syscolumns.length AS [字段长度],
sys.extended_properties.[value] AS [字段描述],
syscomments.text AS [默认值],
CASE syscolumns.isnullable WHEN '1' THEN 'Y' ELSE 'N' END AS [是否允许空值],
ISNULL(COLUMNPROPERTY(syscolumns.id, syscolumns.name, 'Scale'), 0) AS [小数位数],
COLUMNPROPERTY(syscolumns.id, syscolumns.name, 'IsIdentity') AS [自增标识] ,
CASE WHEN EXISTS (SELECT 1 FROM sysobjects WHERE xtype = 'PK' AND name IN
(SELECT name
FROM sysindexes
WHERE indid IN
(SELECT indid
FROM sysindexkeys
WHERE id = syscolumns.id AND colid = syscolumns.colid)))
THEN '√' ELSE '' END AS [主键]
FROM syscolumns
INNER JOIN systypes
ON syscolumns.xtype = systypes.xtype
LEFT JOIN sysobjects ON syscolumns.id = sysobjects.id
LEFT OUTER JOIN sys.extended_properties ON
( sys.extended_properties.minor_id = syscolumns.colid
AND sys.extended_properties.major_id = syscolumns.id)
LEFT OUTER JOIN syscomments ON syscolumns.cdefault = syscomments.id
WHERE (systypes.name 'sysname')
AND syscolumns.id IN (SELECT id FROM SYSOBJECTS WHERE xtype = 'U' AND NAME = '这里是你要查询的表名')
admin
网友回答2022-01-13
你楼主你是不是想通过c#来控制温度项目啊
admin
网友回答2022-01-13
combobox1.Clear;
ADOQuery.Close; //控件 TADOQuery关闭
ADOQuery.SQl.Clear;
ADOQuery.SQL.Text:='select fl_login_name,fl_password from te_userright';
ADOQuery.Open;
while not ADOQuery.Eof do
begin
combobox1.Items.Add(ADOQuery.FieldValues['fl_login_name']);
ADOQuery.Next;
end;
combobox1.Text:='请选择';
combobox1.ItemIndex(1); // 0为第一个, 类推...
admin
网友回答2022-01-13
///summary ///
序列化
/// /summary ///
param name=data要序列化的对象/param
/// returns返回存放序列化后的数据缓/returns
public static byte[] Serialize(object data)
{
BinaryFormatter formatter = new BinaryFormatter();
MemoryStream rems = new MemoryStream();
formatter.Serialize(rems, data);
return rems.GetBuffer();
}
/// summary /// 反序列化 /// /summary
/// param name=data数据缓冲区/param
/// returns对象/returns
public static object Deserialize(byte[] data)
{
BinaryFormatter formatter = new BinaryFormatter();
MemoryStream rems = new MemoryStream(data);
data = null; return formatter.Deserialize(rems);
}

回到
顶部