我想知道有没有办法在不更新相同值的情况下将值插入同一列。
这是我的表结构
Column Name Data Type Allow Nulls
----------- --------- ------------
Expiry Date Date No
现在我想在到期日期中插入多个日期值。那么我该怎么做呢?
所以我的输出应该如下:
Expiry Date
23/3/2014,23/4/2014,23/5/2015
这是我的插入语句
cmd.CommandText = "INSERT INTO Customers (UserID, Validity, Amount, RegisteredDate,
ExpiryDate, FirstName, LastName, Address, State, City, Phone, Mobile, Email)
VALUES(@UserID,@Validity,@Amount,@RegisteredDate,@ExpiryDate,@FirstName,@LastName,
@Address,@State,@City,@Phone,@Mobile,@Email)"
这是我的更新声明:
cmd.CommandText = "UPDATE Customers SET UserID = @UserID, Validity = @Validity,
Amount = @Amount, RegisteredDate = @RegisteredDate, ExpiryDate = @ExpiryDate,
FirstName = @FirstName, LastName = @LastName , Address = @Address, State = @State,
City = @City, Phone = @Phone, Mobile= @Mobile, Email = @Email WHERE UserID = @UserID"