kowmeng 0 Report post Posted October 23, 2008 kepade otai2 dotnet...bleh tolong explain x function fix kt bwah ni utk ape sbenanyer?aku dpt from planetsourcecode...aku gune utk wat function save data to dtbase and it working..lg satu ExecuteScalar tu amende erk?mintak penjelasan ckit..Function fix(ByVal semak As String)fix = Replace(semak, "'", "''")End Function==============================================================================str1 = "SELECT COUNT(*) FROM [studentInfo] where [username]='" & fix(txtUsername.Text) & "'"str2 = "INSERT INTO [studentInfo] ([Name],[iCNumber],[Address],[username],[Password])"str2 = str2 & "VALUES" ' Utk assign value sebab nak simpanstr2 = str2 & "('" & Fix(txtName.Text) & "','" & Fix(txtIcNumber.Text) & "','" & Fix(txtAddress.Text) & "','" & Fix(txtUsername.Text) & "','" & Fix(txtPassword.Text) & "');"dbCon.Open()check = New SqlCommand(str1, dbCon)strcount = check.ExecuteScalar ///ni utk ape erk yg executeScalar ni??1 more thingape tu sintax nothing dlm dotnet nih?cth dbcon as new sqlconnection(bla bla bla)last skali ade coding tu sintax dbcon=nothing..and kenape perlu tulis arahan nothing ni?aku bdk baru ni blaja sdiri2 je ni...hehe!need help Quote Share this post Link to post Share on other sites
sworn 0 Report post Posted October 23, 2008 -func fix tu utk ganti sume text yg ade simbol ' kepada ''-yg execute scalar tu kalo ko tgk kat object browser,dia tulis gunanye utk dptkan row yg first.tapi aku kompius jgk,sbab sql statement ko guna count.bkn ke mmg dpt 1 value je?-yg nothing tu utk kosongkan balik dbcon tu.-tu pendapat aku le,aku pun sama mcm ko jgk,baru nak belajar2 sendiri. Quote Share this post Link to post Share on other sites