does anyone know how to use the vb.net to connect to the SQL server to get the no of rows of a file in the server?
I am a beginner of vb.net
would u pls tell me the solution in detail.

THANK YOU!!!

Recommended Answers

All 3 Replies

if you want Tutorails for insert,update and deletethis is perfect link.
and another one if you want to count the rows in the table you can simply fire a query of "SELECT Count(*) from table" and pass it to SqlCommand. and then exeuct this command with Execute Scalar you will get your result.

how to pass it to SQL comand?
could u give me the key code?
Thanks!!

first see that link which i give you. it's a complete solution for answer. and pass query to command like this.

dim con as new SqlConnection("your connection string")
con.open()
dim cmd as new SqlCommand("Select Count(*) from TableName",con)
dim i as integer=Cmd.ExecuteScalar()
MeaageBox.Show(i)
cmd=nothing
con.close()
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.