// dbCmd.Parameters.Add(new SqlParameter("@CusName", data.CusName)); public static void Insert(tbCommentProducInfo tbCommentProduc) { string q = "insert into [tbCommentProduct]([ProId],[Name],[Email],[Point],[Content],"; q = q + "[Date],[Active]) values(@ProId,@Name,@Email,@Point,"; q = q + "@Content,@Date,@Active)"; SqlCommand cmd = new SqlCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = q; cmd.Connection = GetConnection(); cmd.Parameters.Add(new SqlParameter("@ProId", tbCommentProduc.ProId)); cmd.Parameters.Add(new SqlParameter("@Name", tbCommentProduc.Name)); cmd.Parameters.Add(new SqlParameter("@Email", tbCommentProduc.Email)); cmd.Parameters.Add(new SqlParameter("@Point", tbCommentProduc.Point)); cmd.Parameters.Add(new SqlParameter("@Content", tbCommentProduc.Content)); cmd.Parameters.Add(new SqlParameter("@Date", tbCommentProduc.Date)); cmd.Parameters.Add(new SqlParameter("@Active", tbCommentProduc.Active)); ExecuteNonQuery(cmd); }
public static void Update(tbCommentProducInfo tbCommentProduc) { string q = "update [tbCommentProduct] set [ProId] = @ProId,[Name] = @Name,[Email] = @Email,"; q = q + "[Point] = @Point,[Content] = @Content,[Date] = @Date,[Active] = @Active where [Id] = @Id"; SqlCommand cmd = new SqlCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = q; cmd.Connection = GetConnection(); cmd.Parameters.Add(new SqlParameter("@ProId", tbCommentProduc.ProId)); cmd.Parameters.Add(new SqlParameter("@Name", tbCommentProduc.Name)); cmd.Parameters.Add(new SqlParameter("@Email", tbCommentProduc.Email)); cmd.Parameters.Add(new SqlParameter("@Point", tbCommentProduc.Point)); cmd.Parameters.Add(new SqlParameter("@Content", tbCommentProduc.Content)); cmd.Parameters.Add(new SqlParameter("@Date", tbCommentProduc.Date)); cmd.Parameters.Add(new SqlParameter("@Active", tbCommentProduc.Active)); cmd.Parameters.Add(new SqlParameter("@Id", tbCommentProduc.Id)); ExecuteNonQuery(cmd); }
public static DataTable GetBy_Id(tbCommentProducInfo tb) { string str = "select * from [tbCommentProduct] where [Id]=" + tb.Id; return(GetData(str)); }