简体   繁体   English

数据从 C# 插入 SQL Server

[英]Data insert into SQL Server from C#

I'm attempting to insert some data into Microsoft SQL Server, all the data inserted until it gets to the final table scmd3 .我正在尝试将一些数据插入 Microsoft SQL Server,插入所有数据,直到它到达最终表scmd3 Any ideas as to why its not inserting into that table?关于为什么不插入该表的任何想法?

Here is my code I have so far... I've tried everything I can think of any help would be appreciated... thanks in advance guys.这是我到目前为止的代码......我已经尝试了所有我能想到的任何帮助将不胜感激......提前感谢大家。

Solution: The error wasn't within the insert service code it was in the I service... Just simply adding a question mark solved all my problems.解决方案:错误不在插入服务代码中,而是在 I 服务中...只需添加一个问号即可解决我所有的问题。 Added the question mark after int, also added the if statement and now everything works beautifully!!!!在 int 之后添加了问号,还添加了 if 语句,现在一切正常!!!! Posting the answer because if somenoe had posted anything remotely close it would have saved me a days worth of work looking for a single solution... THANKS for all of you that helped.发布答案是因为如果有人远程发布了任何关闭的东西,它会为我节省一天寻找单一解决方案的工作......感谢你们所有人的帮助。

[DataMember]
public string EmailAddress { get; set; }
[DataMember]
public int? InitialSleep { get; set; }
[DataMember]
public int? RepeatPeriod { get; set; }
[DataMember]
public int? RepeatTimes { get; set; }
[DataMember]
public DateTime? LastSent { get; set; }
[DataMember]
public int TimeSent { get; set; }
[DataMember]
public DateTime DateStarted { get; set; }
[DataMember]
public DateTime LastModified { get; set; }

if statement:如果语句:

    if (textBox1.Text == "")
        userInfo.InitialSleep = null;
    else
        userInfo.InitialSleep = Convert.ToInt32(textBox1.Text);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 从C#中的表单将数据插入SQL Server 2008表 - Insert data into an SQL Server 2008 table from a form in C# 从C#数据表将数据插入SQL Server中的特定列 - Insert data into specific columns in SQL Server from C# Datatable 从Datagridview C#在Sql Server Datable中插入数据 - Insert data in Sql Server datable from Datagridview c# 从C#代码将数据插入SQL Server - Insert data into SQL Server from C# code 使用 C# 将时间数据插入 SQL Server - Insert time data into SQL Server with C# 在C#中使用DbParameter将数据插入SQL Server - Insert data into SQL Server with a DbParameter in C# 从 C# 中的 .sql 文件插入 SQL Server 多行 - SQL Server multiple rows insert from .sql file in C# 如何使用 c# (latebound) 将来自 SQL Server 的货币数据类型插入到 crm 中的货币字段 - How to insert money data type from SQL server into currency field in crm using c# (latebound) 如何授予SQL Server 2008数据库从C#Windows应用程序中的客户端系统插入数据的权限? - How to give the permissions to sql server 2008 database to insert the data from client system in c# windows application? 如何从ac#表单应用程序中选择,更新和插入Sql Server数据 - How to select, update and insert Sql Server data from a c# forms app
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM