cmdSelect.ExecuteScalar()

undulgeTeep

New Member
What is the command for grabbing multiple records from a MSQL d-base. I know the one for single records : <BR><BR>cmdSelect.ExecuteScalar()<BR><BR>thanksFirst you can call the SqlDataReader object and then fill it in with cmdSelect.ExecuteReader<BR>Dim objReader as SQLDataReader<BR>objReader=cmdSelect.ExecuteReader<BR><BR>Then you can DataBind() the objReader to a Web Control (DataGrid)<BR>I think is that...hope i can help<BR><BR><BR>Thanks, My Select isn't a DataGrid though, I'm selecting specific records like "Name", "Address", "Email" etc. so I need to declare each record being pulled.Depending on what you are trying to do, you can still use the DataReader (dr). The dr gives you a way to read multiple columns and records, you can only read them one at a time, and forward only.<BR><BR>dr = cmdSelect.ExecuteReader<BR>dr.Read()<BR>GetUID = dr.GetInt32(0)<BR>dr.Close()<BR><BR>This would get you the first column, index 0, which is and Int32 datatype. You read addition columns the same way, with their column index. The problem with the dr is that you have to know the datatype and index (ordinal) of the column you want. There are way to get this information for each column in your select. It's in the doc.<BR><BR>Hope this helps.
 
Back
Top