.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
SP
satyapriyanayak
Subhransu Sekhar Jena
abhays
DotnetUser

Home >> Forum >> VB.Net >> Post New QuestionBookmark and Share Subscribe to Forum

Display the details of an employee

Posted By: srini     Posted Date: October 31, 2010    Points:2   Category :VB.Net
Hello Everyone! I am doing Employee Attendance Register in vb.net. I am storing the details into SQL Server 2005. Now,i need to retrive form database and display the specific detail of an employee,while clicking the "Show" button.Help me!!!!

Responses
Author: Syed Shakeer Hussain             
Posted Date: November 01, 2010     Points: 5   

Hi,

To show employee Details you can use Gridview Control in ASP.NET

First you have to make a Connection to your sqlserver

Dim DBConn As New SqlConnection("Server=YourServer;UID=YourID;PWD=XXX;Database=YourDS")

Dim dataAdapter As New SqlDataAdapter
Dim ds AS New DataSet


'Get Data from Database
dataAdapter = New SqlDataAdapter("Select * from db_Customer", DBConn)
dataAdapter.Fill(ds,"db_Customer");
Gridview1.DataSource=ds.Tables[0];
Gridview1.DataBind();





Author: srini             
Posted Date: November 01, 2010     Points: 5   

Hi Syed,

Thank you for your post. I am not using DataGridView control to access data from database.Just directly storing the values through connection property. Having fields like empid,empname,designation,timein and timeout. I am having two forms, one for Main (store the values into database) and another for setting form. If i enter 'Empid' in the setting form and click 'show' button,it should show the remaining details of the particular employee.

Help me!!!!!!

Srini
Author: srini             
Posted Date: November 01, 2010     Points: 5   

Hi Syed,

Thank you for your post. I am not using DataGridView control to access data from database.Just directly storing the values through connection property. Having fields like empid,empname,designation,timein and timeout. I am having two forms, one for Main (store the values into database) and another for setting form. If i enter 'Empid' in the setting form and click 'show' button,it should show the remaining details of the particular employee.

Help me!!!!!!

Srini
Author: Ramesh P          Accepted Answer   
Posted Date: November 01, 2010     Points: 10   

Just use the following code,

Dim DBConn As New SqlConnection("Server=YourServer;UID=YourID;PWD=XXX;Database=YourDS")
Dim cmd As New SqlCommand
DBConn.Open()
cmd= New SqlCommand("Select * from db_Customer where empid='"+ txtempid.Text + "'", DBConn)
Dim drAs SqlDataReader = cmd.ExecuteReader()

While dr.Read()
MessageBox.Show("emp_name" & dr(1).ToString())
MessageBox.Show("emp_dept" & dr(2).ToString())
End While
dr.Close()

Regards,


Ramesh

Author: srini             
Posted Date: November 01, 2010     Points: 5   

Hello Ramesh,

Thank you for your post. This has been tried by myself yesterday. Its working good. Anyway thank you for spending your most valuable time with me.

Thanks,
Srini

Srini


Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend