Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Need help with an insert statement

Posted on 2009-07-15
5
Medium Priority
?
169 Views
Last Modified: 2012-05-07
I am in need of some help with an insert statement that I have in my asp.net application.  In my SQLDATA Source I have the following in my Insert area...Below is my code.  What I want to do is the following but it doesn't appear to work.  Does anybody have a clue as to how I can fix this?  Thanks!

Insert Into [dbo].MemberFamilyInfo (MemberFamilyNumber, Allergies, Weight, Age, DateOfBirth, MemberFamilyCreatedDate, MemberFamilyCreatedBy) VALUES (@MemberFamilyNumber, @Allergies, @Weight, @Age,@DateOfBirth, @MemberFamilyCreatedDate,  @MemberFamilyCreatedBy) Where EmployeeID = @EmployeeID
0
Comment
Question by:VBBRett
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 5

Expert Comment

by:Aaronroach
ID: 24862115
Why do you have a where clause on you insert statement?
0
 
LVL 15

Expert Comment

by:jinal
ID: 24862235
You have to insert record or update record ?
0
 

Author Comment

by:VBBRett
ID: 24869537
Aaron, I am trying to insert a a statement with the EmployeeID being the value of the session object.  Is there a way I can do that?
0
 
LVL 15

Accepted Solution

by:
jinal earned 2000 total points
ID: 24869585
now use that insertstatement string in CommandText property.

/* C# */
 
string insertstatement = String.Format("Insert Into [dbo].MemberFamilyInfo (EmployeeID,MemberFamilyNumber, Allergies, Weight, Age, DateOfBirth, MemberFamilyCreatedDate, MemberFamilyCreatedBy) VALUES (@EmployeeID,@MemberFamilyNumber, @Allergies, @Weight, @Age,@DateOfBirth, @MemberFamilyCreatedDate,  @MemberFamilyCreatedBy)", Session["EmployeeID"].ToString());
 
/* VB.net */
 
Dim insertstatement  as String = String.Format("Insert Into [dbo].MemberFamilyInfo (EmployeeID,MemberFamilyNumber, Allergies, Weight, Age, DateOfBirth, MemberFamilyCreatedDate, MemberFamilyCreatedBy) VALUES (@EmployeeID,@MemberFamilyNumber, @Allergies, @Weight, @Age,@DateOfBirth, @MemberFamilyCreatedDate,  @MemberFamilyCreatedBy)", Session["EmployeeID"].ToString());

Open in new window

0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

660 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question