[ kijara camado @ 15.09.2011. 07:11 ] @
Pravim web servis izmedju ostalog i za insert u bazu pri cemu treba da mi vrati ili SCOPE_IDENTITY() ili ex, evo koda: Code: [WebMethod] public int InsertCustomer(string FirstName, string LastName, string Address, string City, string StateProvince, string PostalCode, string Country) { CustomersTableAdapter CustomerTA = new CustomersTableAdapter(); if (FirstName.Length!=0) { int new_customerID = Convert.ToInt32(CustomerTA.InsertQuery( FirstName, LastName, Address, City, StateProvince, PostalCode, Country )); return new_customerID; } else { Exception ex = new Exception("FirstName can`t be null"); return ex.Message; } } I ovaj kod ne radi jer pri else bi trebao da vrati string, a ovde je public int i ne kompajlira se. Ja sam ovo resio tako sto sam umesto public int stavio public object i sad radi ok ![]() Pozz |