C#中怎么将textbox数据库 保存数组传输到数组中

提问者:匿名 & 时间:
>> >> >> >> >> >> >> >> >> >>
c#如何将TextBox里的值保存进数据库表中?求具体代码,用sqldatasource或sqlconnection都行。
string constr = "server=pwd=123;uid=database=kkk";//数据库连接字符串,改成自己的数据库,用户名和密码
SqlConnection con = new SqlConnection(constr);
con.Open();
string sql1 = "INS贰孩蹿绞讷悸寸溪丹娄ERT INTO tb_test(Name) VALUES('"+textbox1.Text.Trim()+"')";
SqlCommand sd1 = new SqlCommand(sql1, con);
sd1.ExecuteNonQuery();
con.Close();呼海斌
c# 数据库 将textbox里的内容保存到数据库中
插入数据库中表 代码哪有问题?SqlConnectio...
根据textbox中的姓名,查询数据库的记录。grid...
C#登录时如何将数据库中的数据与TEXTBOX文本框输...
c#按保存按钮能够保存所有文本框中的值到数据库中的后台...更多相关问题&&
sqlconnection
sqlconnection连接数据库问题
sqlconnection控件添加不上是什么问题
sqlconnection 连接字符串的含义
SqlConnection conn = new Sq...
找不到类型或命名空间名称“SqlConnection”...评论列表(网友评论仅供网友表达个人看法,并不表明本站同意其观点或证实其描述)
c#热门文章在c# winform中如何从textbox读入每一行数据到数组?
[问题点数:20分,结帖人Crayon_Chen]
在c# winform中如何从textbox读入每一行数据到数组?
[问题点数:20分,结帖人Crayon_Chen]
不显示删除回复
显示所有回复
显示星级回复
显示得分回复
只显示楼主
2010年 总版技术专家分年内排行榜第一2009年 总版技术专家分年内排行榜第一
2011年 总版技术专家分年内排行榜第二
2010年 总版技术专家分年内排行榜第一2009年 总版技术专家分年内排行榜第一
2011年 总版技术专家分年内排行榜第二
2010年 总版技术专家分年内排行榜第一2009年 总版技术专家分年内排行榜第一
2011年 总版技术专家分年内排行榜第二
本帖子已过去太久远了,不再提供回复功能。C# 怎么用datatable查询到的数据显示在各textbox里
C# 怎么用datatable查询到的数据显示在各textbox里
textbox1.text= datatable.rows[0]["编号"].tostring();
textbox1.text= datatable.rows[1]["姓名"].tostring();
textbox1.text= datatable.rows[2]["年龄"].tostring();
&&&&&&& private void button1_Click(object sender, EventArgs e)&&&&&&& {&&&&&&&&&&& this.查询账号数据();&&&&&&&&&&& txtzh.Text.Trim();&&&&&&& }&&&&&&& private void 查询账号数据()&&&&&&& {&&&&&&&&&&& DataTable 账号数据 = SqlClass.Getrxjhaccount(string.Format("select * from tbl_account where fld_id='{0}'", txtzh.Text.Trim()));&&&&&&&&&&& try&&&&&&&&&&& {&&&&&&&&&&&&&&& string 密码 = (string)账号数据.Rows[0]["FLD_PASSWORD"];&&&&&&&&&&&&&&& txtpwd.Text = 密码.ToString();&&&&&&&&&&& }&&&&&&&&&&& catch&&&&&&&&&&& { &&&&&&&&&&& &&&&&&&&&&& }&&&&&&& }
问下这里哪里有错误么
txtpwd.Text =账号数据.Rows[0][&FLD_PASSWORD&].ToString();
&&& 按照你说的写了& 点了查询 下面密码那个text不显示内容无反应
相关知识等待您来回答
编程领域专家
& &SOGOU - 京ICP证050897号急!!c#将控制台动态输入的一组学生数据存储到数组student中怎么实现-c/c++-电脑编程网急!!c#将控制台动态输入的一组学生数据存储到数组student中怎么实现作者:kobeycs 和相关&&
用c#将控制台动态输入的一组学生数据存储到数组student中怎么实现学生类如下:public class Student&
public delegate int Comparestudent(Student s1, Student s2);& &
public int Id&
public string Name&
public int Age&
public int Score&
set { score = }&
public Student(int id, string name, int age, int score)&
this.id =&
this.name =&
this.age =&
this.score =&
}------回答---------------其他回答(40分)---------C# code
namespace WinConTest
{
class Program
static void Main(string[] args)
List&Student& lstStu = new List&Student&();
while (true)
Console.Write(&请输入ID:&);
int id = Convert.ToInt32(Console.ReadLine());
Console.Write(&请输入Name:&);
string name = Console.ReadLine();
Console.Write(&请输入age:&);
int age = Convert.ToInt32(Console.ReadLine());
Console.Write(&请输入score:&);
int score = Convert.ToInt32(Console.ReadLine());
Student stu = new Student(id, name, age, score);
lstStu.Add(stu);
Console.WriteLine(&是否继续输入?Y/N&);
if (Console.ReadLine() == &n& || Console.ReadLine() == &N&)
foreach (Student stu in lstStu)
Console.WriteLine(&您输入的学生信息:\r\n& + &ID:& + stu.Id.ToString() + &\r\nName:& + stu.Name + &\r\nAge:& + stu.Age.ToString() + &\r\nScore& + stu.Score.ToString());
Console.WriteLine(&--------------------------------------------------------&);
Console.ReadKey();
}
}
public class Student
{
public delegate int Comparestudent(Student s1, Student s2);
public int Id
public string Name
public int Age
public int Score
set { score = }
public Student(int id, string name, int age, int score)
this.name =
this.age =
this.score =
数据类型的验证没做,凑合看吧!
------回答---------------其他回答(40分)---------
C# code
namespace WinConTest
{
class Program
static void Main(string[] args)
List&Student& lstStu = new List&Student&();
while (true)
Console.Write(&请输入ID:&);
int id = Convert.ToInt32(Console.ReadLine());
Console.Write(&请输入Name:&);
string name = Console.ReadLine();
Console.Write(&请输入age:&);
int age = Convert.ToInt32(Console.ReadLine());
Console.Write(&请输入score:&);
int score = Convert.ToInt32(Console.ReadLine());
Student stu = new Student(id, name, age, score);
lstStu.Add(stu);
Console.WriteLine(&是否继续输入?Y/N&);
if (Console.ReadLine() == &n& || Console.ReadLine() == &N&)
foreach (Student stu in lstStu)
Console.WriteLine(&您输入的学生信息:\r\n& + &ID:& + stu.Id.ToString() + &\r\nName:& + stu.Name + &\r\nAge:& + stu.Age.ToString() + &\r\nScore& + stu.Score.ToString());
Console.WriteLine(&--------------------------------------------------------&);
Console.ReadKey();
}
}
public class Student
{
public delegate int Comparestudent(Student s1, Student s2);
public int Id
public string Name
public int Age
public int Score
set { score = }
public Student(int id, string name, int age, int score)
this.name =
this.age =
this.score =
数据类型的验证没做,凑合看吧!
相关资料:|||||||急!!c#将控制台动态输入的一组学生数据存储到数组student中怎么实现来源网络,如有侵权请告知,即处理!编程Tags:                &                    }

我要回帖

更多关于 数据库 保存数组 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信