SQL Server :: Retrieving Data From Database - To Create A New Consultation Record For A Patient?
Sep 16, 2010
I'm having a question about retrieving data. I'm using VS 2008 and I have to create a new consultation record for a patient and I've already created a database with 3 tables, which are doctor, patient and consultation.
I have 10 records saved in consultation table, and I've made a aspx form which contains a DetailsView that ask for new consultation details to be added. But I have to be able to get the doctor and patient information from the database and put in the DetailsView, then fill in the rest of the consultation details. The information entered have to be written to the database in the consultation table. But I don't know how to get doctor and patient information from database and apply them into the DetailsView so that doctor who wants to add new consultation details can select patient and doctor information from the database.
I was thinking maybe I need to do a query with insert statement and apply into the DetailView,this is the query i have:
INSERT INTO [Consultation] ([ConsultationID], [GPname], [PatientFirstName], [PatientLastName], [Height], [Weight], [IllnessDescription], [Diagnosis], [Date]) VALUES (@ConsultationID, @GPname, @PatientFirstName, @PatientLastName, @Height, @Weight, @IllnessDescription,
@Diagnosis, @Date)
as you can see, I need to get the GPname, PatientFirstName and PatientLastName from the database tables and the rest will be filled in by the doctor.
View 4 Replies
Similar Messages:
Jul 16, 2010
I am wanting to insert a record into a table in SQL then retrieve its key at the same time, the key is a int that is automatically generated, I read something about the '@@Identity' function, is this what I need? How could I then bind this to a label in the ASP.net page?
View 12 Replies
Mar 15, 2011
I have database with 5 tables as follows in my crystal report I am trying to display the patient details of only one patient (whose pid is requested by the user) and display the tests information of that patient.I have created a dataset and have the following code in codebehind of crystalreportviewer
[Code]....
I also have a stored procedure to check the whether the pid entered is same as the pid in the test reports tablessomewhat like follows
[Code]....
but still It is not displaying anything in the crystalreport.
View 6 Replies
May 28, 2010
i have web application it should create single HTML page . that one HTML page should send to the customers.how to create HTML page .i created one page but it retriveing single record from the databse values . my problem is i have to pull all the records from the database and papulate the HTML page. but i am getting only onerecord on that page.my code as follows
string type = ds.Tables[0].Rows[i].ItemArray[4].ToString();
string WAIVN = ds.Tables[0].Rows[i].ItemArray[0].ToString();
string status = "cdcr";
[code]....
but iam not getting all records only single record only iam retriving
View 4 Replies
Oct 18, 2010
In the stord procedure below. I am retreiving all the records for that 1 deal. What I want is to retrieve the most recent record hence the one with the most recent in the AddedDate field.
How can I accomplish this?
(
@DealID int)
AS
SET NOCOUNT ON
SELECT deals_Comments.CommentID, deals_Comments.AddedDate, deals_Comments.UserID, deals_Comments.AddedByEmail, deals_Comments.AddedByIP, deals_Comments.DealID, deals_Comments.Body, deals_Comments.SBody,
ROW_NUMBER() OVER (ORDER BY deals_Comments.AddedDate DESC) AS RowNum
FROM deals_Comments
WHERE deals_Comments.DealID = @DealID
View 6 Replies
Sep 9, 2010
i saved files into database. when i'm displaying i wrote code like this
Dim mySqlDataReader As System.Data.SqlClient.SqlDataReader
Dim mySqlCommand As New System.Data.SqlClient.SqlCommand("pl_Resumes", mySqlConnection)
mySqlCommand.CommandType = CommandType.StoredProcedure
[code]...
View 13 Replies
May 13, 2010
How do I create a unit test that updates a record into database in asp.net
View 1 Replies
May 16, 2010
I have the following stored procedure:
ALTER PROCEDURE Pro_members_Insert
@id int outPut,
@LoginName nvarchar(50),
@Password nvarchar(15),
@FirstName nvarchar(100),
@LastName nvarchar(100),
@signupDate smalldatetime,
@Company nvarchar(100),
@Phone nvarchar(50),
@Email nvarchar(150),
@Address nvarchar(255),
@PostalCode nvarchar(10),
@State_Province nvarchar(100),
@City nvarchar(50),
@countryCode nvarchar(4),
@active bit,
@activationCode nvarchar(50)
AS
declare @usName as varchar(50)
set @usName=''
select @usName=isnull(LoginName,'') from members where LoginName=@LoginName
if @usName <> ''
begin
set @ID=-3
RAISERROR('User Already exist.', 16, 1)
return
end
set @usName=''
select @usName=isnull(email,'') from members where Email=@Email
if @usName <> ''
begin
set @ID=-4
RAISERROR('Email Already exist.', 16, 1)
return
end
declare @MemID as int
select @memID=isnull(max(ID),0)+1 from members
INSERT INTO members (................................
When I run this page, signup.aspx, provide required fields and click submit, the page simply reloads and the database table does not reflect the newly-inserted record. How do I catch the error messages that might be returned from the sproc? how to change signup.aspx so that the insert occurs.
View 3 Replies
Dec 16, 2010
I am retrieving connection string based on value stored in cookie.NowI am making crystal report. I cannot hard code server credential. I have to get these credential from connection string from web.config. so that i can pass these credentials to my crystal report .
ConnectionInfo reportConnectionInfo = new ConnectionInfo();
reportConnectionInfo.ServerName = connection string server name from web.config
reportConnectionInfo.DatabaseName = connection string database name from web.config
reportConnectionInfo.UserID = ...;
reportConnectionInfo.Password = ...;
View 1 Replies
Apr 16, 2010
I am new to NHibernate and have just started right now.I have very simple table contain Id(Int primary key and auto incremented), Name(varchar(100)), Description(varchar(100))
Here is my XML
<class name="DevelopmentStep" table="DevelopmentSteps" lazy="true">
<id name="Id" type="Int32" column="Id">
</id> [code].....
View 1 Replies
Apr 4, 2010
i've two tables trans-mstr having columns as acc_no_from,date,particular,wd_dt,amt,balance and third_party_transfer(table2) having columns as acc_no_frm,acc_no_to,date,amt.now i wnt to retreive date ,particular,wd_dt,acc_no_to,amt,balance where the acc_no_from in third_party_transfer is equal to the no.entered in the textbox of the webpage.i've used datagrid view to show all this.i'm using c# n sql server2005 in this i'm a beginer
View 1 Replies
Dec 19, 2012
I am trying to set up a server on my own pc to test programs i am making, however i keep running into an issue with Access databases saying that it's not registered on my local machine or something like that. So i was thinking of trying MySql instead, but i cant figure out how to set up a database to run on my pc. I have done it using MySql Workbench before to connect to a database set up on my schools server, but that was an already set up database that they created for each student. I want to know how to set one up on my own pc. how to set this up? I tried the server administration section of MySql Workbench but it seems to ask for an existing database already.
View 1 Replies
Jan 26, 2010
I want the users to login and have the app only display their data on the main page. The login control works perfectly...it displays the data...but it displays ALL of the users records instead of just the user that is logged in. I'm still learning how to use SQL...
View 5 Replies
Jul 13, 2010
Before a subscription to a newsletter and the record will be inserted, i'd like to check if the record already exist ina sql-server database. This what i've got as dusfar
adres = TxtEmail.Text
DBConn.Open()
If adres <> "" Then
Try
DBCmd = New SqlCommand("SELECT COUNT(*) FROM TBL_Subscribers WHERE email = @adres)", DBConn)
''Add
DBCmd.Parameters.Add("@Email", SqlDbType.NVarChar).Value = adres
DBCmd.ExecuteScalar()
DBAdap = New SqlDataAdapter("SELECT * FROM TBL_Subscribers ORDER BY ActivateDate", DBConn)
DBAdap.Fill(DS)
Catch exp As Exception
Response.Write(exp)
End Try
End if
View 4 Replies
Feb 8, 2011
how to insert record in sql server database by using linq?
still i m using MVC 3.0 send me full detail example for insert record using Linq
View 24 Replies
Apr 1, 2011
What I want to do is to store new article and for each article choose a category..
I have 3 tables for example :
1. Article table : ArticleID - int , Article - nvarchar(max) .......
2. Categories table : CategoryID - int , CategoryName - nvarchar(150)
3. Article_Categories : ArticleCategoryID - int , ArticleID - int , CategoryID - int (And I set up relation in this table...)
I can store data into tables 1 and 2 that is working fine.. But I stuck with Table 3.
So far my code looks like this :
protected void Button1_Click(object sender, EventArgs e) //Add new Category (working fine)
{
string connectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
string insertSql = "INSERT INTO Categories(catname) VALUES(@catname)";
[code]....
View 9 Replies
Jun 19, 2012
I have a id in label1 ...
on button click i want to delete the data of id from database ...
View 1 Replies
Jul 27, 2010
I have two tables Users (Userid, Name, PhoneNumber) Applications (ApplicationsId,UserId, ApplicationName, ActiveDate)
Every user will have more than 1 application.
In Nhibernate using lazy loading I can get the users data along with all the applications for every user. So, I used to do something like user.applications[i].Applicationname to get all the applications.
But, Now how do i retrieve all the applications along with the users data using oracle commands. I know how to get one application using joins. But, how do i retrieve multiple applications and store it in a IList.
View 1 Replies
Feb 19, 2010
copying some data from an existing remote database(SQL2005) to an existing local database.First - I have very little experience in this area. I'm using Visual Web Developer 2008 (VB). Currently if I want to update some data in the local database I do something like this:
Dim conn As Data.SqlClient.SqlConnection = New Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings("CCCdbConnectionString").ConnectionString)
Dim cmd As Data.SqlClient.SqlCommand = New Data.SqlClient.SqlCommand("UPDATE [Orders] Set [OrderStatus]
[code]...
View 3 Replies
Sep 14, 2010
I have a page which will retrieve data base on drop down lists and place the data onto a gridview. When the data was entered, each field was entered with multi-selected and delmited by a comma. In the database, some fields will have a string with multi information delmited by the comma, for example, Chicago, Atlanta, NYC will be recorded and place in the field in the database. I'm trying to search now but with a dropdown list with Chicago, Atlanta, and NYC being an individual record. If the person selects NYC, all of the records from NYC will appear even though Chicago and Atlanta are part of the string.
The following is the code for the current page:
[Code]....
View 5 Replies
Jan 4, 2010
I'm using update panel in the master page. Half of my web page will retreive the data from the database in dynamic. As, my update panel is in master page(with ajax loader), it is taking much time for every event. Is there any other advanced method to get the data from the database instead of using update panel.
View 2 Replies
Sep 24, 2012
I have one text box in my page and 1 button
users type some number in this TB
I want when users enter their number in text box and click on button to insert it to database
it checked if in database was that number it show message that "this number is in database please type other number"
how i can do it?
View 1 Replies
Apr 20, 2010
I have successfully used resources to translate my UI and I am now moving on to allowing the ability for the admin to translate database content.I'm looking for video tutorials / docs on database structure for localised info and how to retrieve localised data using stored procedures based on the selected culture.
View 3 Replies
Jan 25, 2010
i am doing a web page in asp.net which holds logos of members in the page in a grid view.each cell is a link to the relevant member's website.
i want to popup an image of the member's website when the mouse is hovered over a certain cell. for this a snapshot of the website is stored in a database an for the onmouse over event i want to make it pop up.
i want to know whether using ajax or JavaScript is more appropriate for this problem.
i want to know how this can be done.
View 4 Replies
Oct 31, 2010
I have been able to save an image in the database but i can not preview it
View 4 Replies