4 Replies - 6854 Views - Last Post: 13 January 2009 - 04:12 AM Rate Topic: -----

#1 raghavendra  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 20
  • Joined: 11-August 08

How to retrieve values from sql database

Post icon  Posted 31 December 2008 - 04:35 AM

Hi all,

I am new to asp.net programming, I have created an sql table for Employees and now i am able to save the values from my web page to the database but i am not able to retrieve the same values for editing purpose can any one help me please its very urgent,
any help or suggestions are greatly appreciated

Thanks in advance,
Raghu.
Is This A Good Question/Topic? 0
  • +

Replies To: How to retrieve values from sql database

#2 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1641
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: How to retrieve values from sql database

Posted 31 December 2008 - 06:57 AM

Show us what you've tried so far

[rules][/rules]
Was This Post Helpful? 0
  • +
  • -

#3 raghavendra  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 20
  • Joined: 11-August 08

Re: How to retrieve values from sql database

Posted 31 December 2008 - 07:06 AM

View PostPsychoCoder, on 31 Dec, 2008 - 05:57 AM, said:

Show us what you've tried so far

[rules][/rules]



Well i dont know any thing about data retrieving so to show you i dont have anything except the part for saving the values into the database

My code goes here:
 Protected Sub btnsave_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnsave.Click
		'myConnection = New Data.SqlClient.SqlConnection("Data Source=CONFAI17\SQLEXPRESS;Initial Catalog=HRDATA;Integrated Security=True")
		myConnection = New Data.SqlClient.SqlConnection("Data Source=server1;Initial Catalog=master;Persist Security Info=True;User ID=sa;Password=pass#word1")
		Dim InsertCmd = "Insert into Employeedata(ID,EName,Department,Designation,ContactNumber,EmergencyContact,OfficeNumber,Email,PersonalEmail,Dob,Doj,Address,BloodGroup,BankName,Branch,AccountNumber,Details_of_Id_Card,Salary) values('" & txtid.Text.ToString() & "','" & txtname.Text.ToString() & "','" & ddldept.SelectedItem.ToString() & "','" & txtdesig.Text.ToString() & "','" & txtcnum.Text.ToString() & "','" & txtemernum.Text.ToString() & "','" & txtoffnum.Text.ToString() & "','" & txtemail.Text.ToString() & "','" & txtpersonalid.Text.ToString() & "','" & d.Date.ToString() & "','" & s.Date.ToString() & "','" & txtadd.Text.ToString() & "','" & ddlbgrp.SelectedItem.ToString() & "','" & txtbname.Text.ToString() & "','" & txtbranch.Text.ToString() & "','" & txtaccnum.Text.ToString() & "','" & ddldoic.SelectedItem.ToString() & "','" & txtsal.Text.ToString() & "')"
		myCommand = New Data.SqlClient.SqlCommand(InsertCmd, myConnection)
		myConnection.Open()
		myCommand.ExecuteNonQuery()
		myCommand.Connection.Close()
	End Sub


Please guide me through any tutorial or any suggestion on how to retrieve values from the database for editing and later when the editing is finished then the user should save the data back to the database.

Thanks for your reply,
Raghu.
Was This Post Helpful? 0
  • +
  • -

#4 eclipsed4utoo  Icon User is offline

  • Not Your Ordinary Programmer
  • member icon

Reputation: 1524
  • View blog
  • Posts: 5,960
  • Joined: 21-March 08

Re: How to retrieve values from sql database

Posted 31 December 2008 - 07:07 AM

PsychoCoder did an article on interactions with SQL.

http://www.dreaminco...wtopic31314.htm
Was This Post Helpful? 0
  • +
  • -

#5 raghavendra  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 20
  • Joined: 11-August 08

Re: How to retrieve values from sql database

Posted 13 January 2009 - 04:12 AM

View Posteclipsed4utoo, on 31 Dec, 2008 - 06:07 AM, said:

PsychoCoder did an article on interactions with SQL.

http://www.dreaminco...wtopic31314.htm



Hi,
i did all that stuff of creating database and all but I have to change the values of a web page according to the drop down list values selection. Like if the user selects a value from the drop down list the values for the respective fields automatically.

How can we do that?
Raghu.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1