Zpupster
65 pts. | Jul 31 2009 10:16PM GMT
thank you so much. i am learning, i imagine that needs to be called for
these to work:
SqlCommand cmd = new SqlCommand(sql, conn);
SqlParameter[] param = new SqlParameter[4];
I am not sure what he or she is doing here:
catch (System.Data.SqlClient.SqlException ex)
well these are the errors i am getting now.
—— Build started: Project: C:WebSite4, Configuration: Debug Any CPU ——
Validating Web Site
Building directory ‘/WebSite4/’.
C:WebSite4Default.aspx.cs(47,49): error CS0103: The name ‘SqlDbType’ does not exist in the current context
C:WebSite4Default.aspx.cs(48,50): error CS0103: The name ‘SqlDbType’ does not exist in the current context
C:WebSite4Default.aspx.cs(49,53): error CS0103: The name ‘SqlDbType’ does not exist in the current context
C:WebSite4Default.aspx.cs(50,53): error CS0103: The name ‘SqlDbType’ does not exist in the current context
C:WebSite4Default.aspx.cs(62,31): error CS0103: The name ‘CommandType’ does not exist in the current context
Validation Complete
========== Build: 0 succeeded or up-to-date, 1 failed, 0 skipped ==========
thanks,
craig
Carlosdl
29795 pts. | Jul 31 2009 11:44PM GMT
For the SqlDbType and CommandType enums, you need to include the System.Data namespace
Carlosdl
29795 pts. | Jul 31 2009 11:49PM GMT
Sorry, this line:
catch (System.Data.SqlClient.SqlException ex)
is part of a try-catch construct. It will catch any SQL error (exception) generated by the instructions inside the TRY block, and will execute these lines:
string msg = “Insert Error:”; msg += ex.Message; throw new Exception(msg);
Zpupster
65 pts. | Aug 1 2009 12:09AM GMT
thanks carlos that worked by adding those 2.
but this is not loading into the database. i checked by going to the table and
asked it to show the table data. it also is not responding ” Save Successfully! ”
i do not why it is not working, do know of any other examples that may work?
thanks
craig
Carlosdl
29795 pts. | Aug 1 2009 1:24AM GMT
Maybe the Button1_Click procedure is not being called.
Try this:
Remove this part from your code:
protected void Button1_Click(object sender, EventArgs e)
{
StartUpLoad();
}
Then go to the view designer and double-click on “Save” button, and put this inside the procedure it has just generated, and try again.:
StartUpLoad();
Zpupster
65 pts. | Aug 1 2009 1:59AM GMT
ty carlos,
thanks for hanging in there with me. i got the images to go into the database.
now i have to find a script to get to view them, but that will be tommorow.
good night,
thanks again
craig






