Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified AuthorsApplication/.vs/AuthorsApplication/v16/.suo
Binary file not shown.
9 changes: 8 additions & 1 deletion AuthorsApplication/AuthorsApplication/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ private void InitializeForm()

conn = new SqlConnection(connString);

//run sql files - create view
string viewScript = File.ReadAllText("testViewNoParam.sql");
//Below is commented out because it is mostly a copy of how the procedure was created and I am not sure how that works.
//SQLCommand createViewScript = new SQLCommand(viewScript, conn);



//run sql files - generate procedure
string script = File.ReadAllText("setup.sql");
if (conn.State != ConnectionState.Open) conn.Open();
Expand All @@ -44,7 +51,7 @@ private void listBox1_SelectedIndexChanged(object sender, EventArgs e)

//TODO - LIST Books per author - need view
string currentSelection;

// We will have to use an ALTER VIEW statement to change the au_id in the WHERE clause

currentSelection = (listAuthors.SelectedItem as DataRowView)["au_id"].ToString();
//set global variable - used for sp button
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
CREATE VIEW testViewNoParam
SELECT au_fname, au_lname, title
FROM authors
JOIN titleauthor ON authors.au_id = titleauthor.au_id
JOIN titles ON titleauthor.title_id = titles.title_id
WHERE au_id = '172-32-1176'
Binary file not shown.