Jump to content
Sign in to follow this  
kowmeng

Explain Ckit Ape Maksud Sintax Coding Nih..

Recommended Posts

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 simpan

str2 = 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 thing

ape 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

Share this post


Link to post
Share on other sites

-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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...