Solved

Need help with an insert statement

Posted on 2009-07-15
5
166 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 500 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Check number of row prior to displaying gridview 10 72
RLDC Reporting in Visual studio 11 42
How to filter by key press ? 6 54
Problem to copy file 14 45
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…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

740 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