Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 SQL Server Administration (2008)
 SQL Server Username Exist Check

Author  Topic 

Angga Lisdiyanto
Starting Member

2 Posts

Posted - 2012-10-31 : 11:33:39
Assalamu'alaikum,

I have a problem with my syntax for user registration in my asp.net 4 website, it's say error Invalid column name 'count'.

This is my syntax :


Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If IsPostBack Then
Dim koneksi As New SqlConnection(ConfigurationManager.ConnectionStrings("corefigh_anggotaConnectionString1").ConnectionString)
koneksi.Open()
Dim query As String = "select count from anggota where nama_pengguna='" + txtnama.Text + "'"
Dim penggunaaktif As New SqlCommand(query, koneksi)
Dim temp As Integer = Convert.ToInt32(penggunaaktif.ExecuteScalar.ToString)
If temp = 1 Then
Response.Write("Nama pengguna sudah ada")
End If
End If
End Sub



And the error highlight is pointing at this line :

Dim temp As Integer = Convert.ToInt32(penggunaaktif.ExecuteScalar.ToString)


www.anggalisdiyanto.net

Angga Lisdiyanto
Starting Member

2 Posts

Posted - 2012-10-31 : 12:11:11
SOLVED!

I forgot, i must add COUNT(filed_name). Sorry for my bad question.

www.anggalisdiyanto.net
Go to Top of Page
   

- Advertisement -