Click here to Skip to main content
15,899,126 members
Home / Discussions / C#
   

C#

 
GeneralRe: Simulator Pin
ESTAN26-Sep-07 2:02
ESTAN26-Sep-07 2:02 
GeneralRe: Simulator Pin
prog_omer_esmail26-Sep-07 3:12
prog_omer_esmail26-Sep-07 3:12 
GeneralRe: Simulator Pin
J4amieC26-Sep-07 3:35
J4amieC26-Sep-07 3:35 
GeneralRe: Simulator Pin
Pete O'Hanlon26-Sep-07 4:12
mvePete O'Hanlon26-Sep-07 4:12 
GeneralRe: Simulator Pin
prog_omer_esmail26-Sep-07 5:12
prog_omer_esmail26-Sep-07 5:12 
Questionsize of memorystream.toarray() Pin
JABIR E26-Sep-07 1:12
JABIR E26-Sep-07 1:12 
AnswerRe: size of memorystream.toarray() Pin
Guffa26-Sep-07 1:22
Guffa26-Sep-07 1:22 
QuestionError because of Empty Strings in Method Pin
daniel_v26-Sep-07 1:06
daniel_v26-Sep-07 1:06 
So i have this method, that accepts data inputs of various types from a web form...now some of them (if not all) can be left empty...and thus insert nothing. now my coding is not allowing it to accept these empty strings, any ideas?

This is the coding i am using at the moment;

        protected void Submit_OnClick(object sender, EventArgs e)<br />
        {<br />
            try<br />
            {<br />
                //Insert records in InsertVslLic1() Method<br />
                vesselLicense.InsertVslLic1(Convert.ToDateTime(txtRegistrationDate.Text), Convert.ToInt32(txtMartimeRegistrationNumber.Text), txtVesselName.Text, <br />
                    Convert.ToInt32(ddlVesselCategory.SelectedValue),rblOperativeStatus.SelectedValue, Convert.ToInt32(ddlBasePort.SelectedValue), <br />
                    txtRemarks.Text, txtPreviousAuthorisation.Text, Convert.ToDouble(txtOverallLenght.Text),Convert.ToDouble(txtWidth.Text), <br />
                    Convert.ToDouble(txtHeight.Text), txtConstructionPlace.Text, txtCountry.Text, Convert.ToInt32(txtContructionYear.Text), txtShipyard.Text, <br />
                    txtHullMaterial.Text,txtStructuralRemarks.Text);<br />
<br />
                //Display Success Message<br />
                lblMessage.Text = "Data Input Successful";<br />
<br />
                //Redirect to Page Two [VesselLicense_Page2.aspx]<br />
                Response.Redirect("VesselLicense_Page2.aspx", false);<br />
              }<br />
            catch (Exception ex)<br />
            {<br />
                lblMessage.Text = ex.Message;<br />
                //throw ex;<br />
            }


This is the InsertVslLic1() Method used to input the data in the database (SQL Server 200)

        public void InsertVslLic1(DateTime regDate, int martimeRegNo, string vesselName, int vesselCategory, string operativeStatus, int basePort, string vesselRemarks,<br />
            string previousAuthorisation, double lenght, double width, double height, string constructionPlace, string country, int constructionYear, string shipyard, string hullMaterial,<br />
            string structuralRemarks)<br />
        {<br />
            try<br />
            {<br />
                //Open Connection<br />
                DBConnection db = new DBConnection();<br />
                db.OpenConnection();<br />
<br />
                //Create SQL string<br />
                string _sqlString = ("EXECUTE spA_FSH_InsertVslLic1 @RegistrationDate = '" + regDate<br />
                                                              + "', @MartimeRegNum ='" + martimeRegNo<br />
                                                              + "', @FishingVesselName ='" + vesselName<br />
                                                              + "', @FishingVesselType ='" + vesselCategory<br />
                                                              + "', @OperationalStatus ='" + operativeStatus<br />
                                                              + "', @FishingVesselBasePort ='" + basePort<br />
                                                              + "', @FishingVesselRemarks ='" + vesselRemarks<br />
                                                              + "', @PreviousAuthorisation ='" + previousAuthorisation<br />
                                                              + "', @FishingVesselLenght ='" + lenght<br />
                                                              + "', @FishingVesselWidth ='" + width<br />
                                                              + "', @FishingVesselHeight ='" + height<br />
                                                              + "', @ConstructionPlace ='" + constructionPlace<br />
                                                              + "', @ConstructionCountry ='" + country<br />
                                                              + "', @ConstructionYear ='" + constructionYear<br />
                                                              + "', @ConstructionShipyard ='" + shipyard<br />
                                                              + "', @ConstructionHullMaterial ='" + hullMaterial<br />
                                                              + "', @ConstructionRemarks ='" + structuralRemarks<br />
                                                              + "', @HomePortID ='" + basePort+ "'");<br />
                //Execute SQL String<br />
                db.RunSQLQuery(_sqlString);<br />
            }<br />
            catch (Exception ex)<br />
            {<br />
                throw ex;<br />
            }



Any ideas on how i can fix this? thank you
AnswerRe: Error because of Empty Strings in Method Pin
originSH26-Sep-07 1:13
originSH26-Sep-07 1:13 
GeneralRe: Error because of Empty Strings in Method Pin
daniel_v26-Sep-07 1:20
daniel_v26-Sep-07 1:20 
GeneralRe: Error because of Empty Strings in Method Pin
daniel_v26-Sep-07 1:56
daniel_v26-Sep-07 1:56 
AnswerRe: Error because of Empty Strings in Method Pin
Scott Dorman26-Sep-07 3:49
professionalScott Dorman26-Sep-07 3:49 
QuestionRegarding datetime picker Pin
Praveen02926-Sep-07 1:00
Praveen02926-Sep-07 1:00 
AnswerRe: Regarding datetime picker Pin
originSH26-Sep-07 1:09
originSH26-Sep-07 1:09 
AnswerRe: Regarding datetime picker Pin
PIEBALDconsult26-Sep-07 4:37
mvePIEBALDconsult26-Sep-07 4:37 
Questioncrystal reports totalPageCount Pin
Seishin#26-Sep-07 0:45
Seishin#26-Sep-07 0:45 
AnswerRe: crystal reports totalPageCount Pin
il_masacratore27-Sep-07 21:44
il_masacratore27-Sep-07 21:44 
Questioni need code Pin
chyasir26-Sep-07 0:00
chyasir26-Sep-07 0:00 
AnswerWrong site Pin
Vikram A Punathambekar26-Sep-07 0:06
Vikram A Punathambekar26-Sep-07 0:06 
AnswerRe: i need code Pin
Sathesh Sakthivel26-Sep-07 0:23
Sathesh Sakthivel26-Sep-07 0:23 
AnswerRe: i need code Pin
benjymous26-Sep-07 0:28
benjymous26-Sep-07 0:28 
GeneralRe: i need code Pin
Pete O'Hanlon26-Sep-07 0:37
mvePete O'Hanlon26-Sep-07 0:37 
GeneralRe: i need code Pin
Malcolm Smart26-Sep-07 2:41
Malcolm Smart26-Sep-07 2:41 
Answeri need car Pin
J4amieC26-Sep-07 0:31
J4amieC26-Sep-07 0:31 
JokeRe: i need car Pin
Rajesh R Subramanian2-Oct-07 23:02
professionalRajesh R Subramanian2-Oct-07 23:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.