用.net做一个程序 实现sql server数据库下的 增删改查

来源:百度知道 编辑:UC知道 时间:2024/07/06 13:54:34
时间很紧,我有VB2005基础,但数据库没学过,时间很紧。希望大侠告诉我思路就好,该学那一块有针对性,谢谢大家!

数据库不难 只学增删改查 最多分钟就能掌握
select * from 表 where 字段 = 条件 这个是查询 这个表里面所有内容 加上where 就是根据条件查寻了

insert into 表(里面是字段可以不写 不写就默认是插入所有) values (对应字段进行添加)

update 表 set 字段 where 字段 = 条件

delete from 表 where 字段 = 条件
drop table 表 删除整个表

第一个删除只能删除数据
第二个删除可以彻底删除整个表

using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;

namespace 编辑
{
class DB
{
SqlConnection scon = new SqlConnection();
public DB()
{
scon.ConnectionString = "Data Source=.;Initial Catalog=jiu;Integrated Security=True";
}
public Jiu select(string name)
{
SqlCommand scom = new SqlCommand();
scom.Connection = this.scon;
scom.CommandText = "select * from jiu where name ='" + name + "'&