TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
wooi83
NA
18
0
unable to insert data. Pls help.
Mar 31 2004 4:13 PM
i need to know why i can't insert both variables to my database? it keeps return false when i click save button. no compilation and runtime errors occur. is my database table restricted access or my sql query is has erros? please give suggestion for this. public bool StoreBooksReservation(string UID, string BID) { SqlParameter[] Param = { new SqlParameter("@reservationUserID", SqlDbType.VarChar), new SqlParameter("@reservationBookID", SqlDbType.VarChar) }; Param[0].Value = UID; Param[1].Value = BID; try { return DC.SProcedures("SP_InsertReserve", Param); } catch { return false; } } public bool SProcedures(String SProcName, SqlParameter[] Param) { SqlCommand myCmd = CreateCommand(SProcName, Param, CommandType.StoredProcedure); try { myCmd.ExecuteNonQuery(); return true; } catch { return false; } } //stored procedure in sql 2000 CREATE PROCEDURE SP_InsertReserve ( @reservationUserID varchar, @reservationBookID varchar ) AS INSERT INTO dbo.RESERVATIONS( dbo.RESERVATIONS.reservationUserID, dbo.RESERVATIONS.reservationBookID ) VALUES ( @reservationUserID,@reservationBookID ) GO
Reply
Answers (
3
)
Abt Indexers
Selecting area on image