Select, Insert, Update, and Delete – SQL Question

R

ryguy7272

Conceptually, I understand what needs to be happen, but technically, I don’t
really know how to do it. Here is my Select statement:

SELECT tblEvents.Event, tblPubs.Name, tblPubs.Address, tblPubs.City,
tblPubs.State, tblPubs.OnDate FROM tblPubs INNER JOIN tblEvents ON
tblPubs.NeighborhoodID = tblEvents.NeighborhoodID WHERE (tblEvents.Event =
@Event)

That works just fine!! Items in my GridView (I'm working in SQL Server) are
updated based on what is selected from a DropDownList. Again, that part
works fine. Now, I am trying to add a few features to allow a particular
user (who logs into his account through a login form) to Insert, Update, and
Delete records. That’s what these controls are for, right. The user can do
this completely through a web browser, when the ASP.NET project is on the
server, as opposed to localhost, right

My question is, how would I design the SQL to allow the user to Insert (and
add ‘Event’, ‘Name’, ‘Address’, ‘City’, ‘State’, and ‘OnDate’)?

Similarly, how would I set up the SQL to allow this user to Update the
records and Delete the records? The tblEvents has the following Fields:
[Name] ,[Address] ,[City] ,[State] ,[NeighborhoodID] ,[ID] and ,[OnDate].
The tblEvents had the following Fields: [Event] and [NeighborhoodID].

For my Update statement, the following seems to make sense to me, but it is
not working:
UPDATE tblPubs
SET Event=@Event, Name=@name, Address=@Address, City=@City, State=@State,
OnDate=@OnDate
WHERE Event <> Null, Name <> Null, Address <> Null, City <> Null, State <>
Null, OnDate <> Null;

Please help with the Update, insert, and Delete.

Thanks,
Ryan--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top