'WebMatrix.Data.DynamicRecord'형식을 'int'로 변환 할 수 없습니다. QueryValue 메서드의 값을 int로 출력하려고하면 예외가 발생합니까?'WebMatrix.Data.DynamicRecord'형식을 'int'로 변환 할 수 없습니다.
public class SaveCustomerData : IDisposable
{
private readonly string _connectionString;
private readonly Database _db;
public SaveCustomerData(string connectionString)
{
_connectionString = connectionString;
_db = Database.Open(connectionString);
}
public void Insert(string fname, string lname, string phone, string cellno, DateTime dob, string gender, string address, string address2, string creditno, string city, string postalcode, string email) {
var uid = Convert.ToInt32(_db.QuerySingle("SELECT UserID FROM UserProfile WHERE [email protected]",email));
_db.Execute("INSERT INTO Customer_Table (customer_fname, customer_lname, customer_phone, customer_mobile, customer_dob, customer_gender, customer_address, customer_address2, customer_credit_no, customer_city, customer_postal, UserID) VALUES (@0, @1, @2, @3, @4, @5, @6, @7, @8, @9, @10, @11, @12)",
fname, lname, phone, cellno, dob, gender, address, address2, creditno, city, postalcode, uid);
이 "[0]"이 (가) 열 UserID를 가리키고 있습니까? – mohdahmed108
방금 내 게시물을 업데이트했습니다. [0]을 사용하여 값을 취할 수 있습니다.이 값은 인덱스 0 인 열의 값을 반환하거나 열의 이름을 사용하여 값을 검색 할 수 있습니다. – Christos
정말 고마워요. 이것은 효과가있다! – mohdahmed108