MIS 325 Exam #3 study guide
What is the purpose of parameters
Add security and retrieval systems
What is .fillschema used for
Adds a DataTable to the specified DataSet and configures the schema to match that in the data source based upon the specified SchemaType and DataTable
Write a parameterized SQL statement and then load a database and display the data in gridview
Protected sub Button_click1(sender as onject, e as system.eventargs) handles Dim dectotalsales, as decaveragesales as decimal Dim intcountsales as integer Dim salesdataadapter as new sqldataadapter("select top 25 * from featherman.sales order by sale_id desc"' con) Dim salesdatatable as new datatable try salesdataadapter.fill(salesdatatable) intcountsales = salesdatatable.rows.count Gridview1.datasource = salesdatatable Gridview1.databind() catch ex as exception reponse.write(ex.message) end try
How do sql select statements change when you add a parameter
The parameter changes what values will be transferred to the SQL select statement which will then further clean the data, The parameters also define which column in the database table the value will be stored in
Discuss the insert and update methodology of writing business applications
This methodology requires you need to manually open and close the connection to the datatable yourself Also allows for the program user to update a specified row, not every row of data Useful for updating information related to the business transaction, for example the customers address didnt change just his total sales
What are SQL Select statements
allow for the user to pass through information to a SQL statement to be used to insert delete or filter data
What are update set commands
allow program user to update the data of an existing table in a database from new values inputted into a web form, by either updating single rows or multiple rows by using a where statement
How do parameters work
allow the program user to enter criteria into a web form then transferred to a sql select statement that is run by the dataAdapter
What attributes does .fillschema have
column name, data type, what its being used for, default value, auto numbering(primary key), name conventions, and all related data to the business problem
What is included in the schema
column names, data types, primary and foreign keys
The ________ allows for the data adapter to be a very reliable way to save a webpage back to a secure SQL database
command builder
Why is command builder useful
enables a one line data table, making inserting rows with noSQL statement really fast. Also updates the SQL from memory, and simplifies insert statements to one line of code
Why are parameters in SQL statements so useful
help filter data, as well as protect web pages form security threats
parameter
is used to retrieve the value selected in the drop down list and pass that value into the SQL select statement, allowing the program user to filter the data retrieved from the database
WHy is the where statement so important when using update set command
it is important to define which rows of the existing data table you want to update
When creating sql database tables what attributes must be decided on
number of tables to include in your database, and table names for each table number of columns and names for each column datatype, null not null, primary and foreign keys
Write code for an update set command with a where statement to update just ONE row
protected sub updatedata() dim cmdupdateinfo as new sqlcommand("update featherman.customers set saleamount +=1, totalsale += @p2 where customerID += @p1, con) with cmdupdateinfo.parameter.clear()
what coding does .fillschema replace
replaces code used to define our data tale columns in the init procedure
What object runs .fillschema
the dataAdapter
What procedure uses .fillschema
the initialization procedure when we are just starting up after we define the sql connection
What is schema
the structure of a table or database
What are some common scenarios that a business web page application could benefit from displaying filtered lists of data or summary data
to determine what accounts have become bad debts, as well to determine and display the cost and calories of certain food groups in a restaurant depending on toppings
Why is .fillschema useful
to facilitate data accuracy
why call sub procedures from another procedure
to increase modularization, which allows you to break the code up to make it easier to find/fix problems allows the program user to update multiple parts of the same code throughout the program makes code more organized and easier to use
why use try/catch blocks
to save the now populated row of data to the in memory datatable to use that in memory data table as the datasource for the streamlined dataadapter .update procedure protect data from blowing up, and to check accuracy of data before updating the final sheet
how is the commandbuilder object used
used in the data adapters method to insert data into a sql database easily, by auto generating SQL insert commands for the new rows of data
Breifly discuss an ASP.NET/SQL server program that you can now write
using ASP.NET/SQL server would allow you to write a program to take user data such as an employees position, and daily time cards, and then store that info in a SQL database with employee pay rate, to keep a running total of gross pay, what will be paid on next paycheck, gross hours, total taken in taxes, etc
what does .fillschema do
when the program is started, the procedure allows to add a new predefined row to the datatable and collect the webpage entered data into the columns for the blank row The column will already have a name, data type, restrictions and default values
What do you need to know when using the "insert and update" methodology of writing business applications
you need to understand the business requirements to make sure that you are updating the right tables/columns, because you could updating multiple tables, as well as you need to specify which columns you want