how to retrieve data in dropdown list and display in datagridview

Posted by Scruphead43 under ASP.NET on 6/9/2012 | Points: 10 | Views : 2823 | Status : [Member] | Replies : 2
1.how to retrieve data in data grid view that has a drop down list

here my codes


Dim cls As New dataEntry
cls.ReadINI()
Dim db As New MYDBConnection
Dim constr As String = "Data Source =" + cls.linkServer + ";Persist Security Info=False;Initial Catalog=" + cls.LINKDB + ";User ID =" + cls.LINKUSER + ";Password =" + cls.LINKPASS + ";pooling=false"
db.SetConnectionString(constr)

Dim sqlgen As String = "select employeeid as IDNo,concat(concat(Lastname,', ',Firstname,' ',Left(Middlename,1),'.')) as fullname from hris.recpersonalinformation "

Dim ds As DataSet = db.Execute_SQL_DataSet(sqlgen, "Name")
ds = Execute_DataSet(sqlgen)
getdropmon()
GridView2.DataSource = ds
GridView2.DataBind()




Responses

Posted by: Chikkanti on: 6/9/2012 [Member] Starter | Points: 25

Up
0
Down

Posted by: Scruphead43 on: 6/10/2012 [Member] Starter | Points: 25

Up
0
Down
thanks for the site that you given...

but my problem is how to get data from the database and display it in drop down...
this code is nothing happened or no display while retrieving data...
plz help me....how to get this code to be perfect...


here my codes:


Dim cls As New dataEntry

cls.ReadINI()
Dim db As New MYDBConnection
Dim constr As String = "Data Source =" + cls.linkServer + ";Persist Security Info=False;Initial Catalog=" + cls.LINKDB + ";User ID =" + cls.LINKUSER + ";Password =" + cls.LINKPASS + ";pooling=false"
db.SetConnectionString(constr)

Dim sqlgen As String = "select concat(date_format(timeIn,'%r'),'-',date_format(timeOut,'%r')) as shift from hris.payrdtr where employeeid = '" & GridView2.SelectedIndex.ToString & "'"

Dim ds As DataSet = db.Execute_SQL_DataSet(sqlgen, "Name")
ds = Execute_DataSet(sqlgen)

GridView2.DataSource = ds
GridView2.DataBind()

Scruphead43, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response