c# - I want to Insert RadioButton Value in SQL Database using Classes -


i created class name employeedata write code here , want insert radiobutton value in sql database

 public static void addemployee(employee employee)         {             string connstring = configurationmanager.connectionstrings["employee"].connectionstring;             sqlconnection conn = new sqlconnection(connstring);              using (conn)             {                 sqlcommand cmd = new sqlcommand("addemployee", conn);                 cmd.commandtype = commandtype.storedprocedure;                                 cmd.parameters.add("@name", sqldbtype.nvarchar, 50).value = employee.name;                 cmd.parameters.add("@fname", sqldbtype.nvarchar, 50).value = employee.fname;                 cmd.parameters.add("@address", sqldbtype.nvarchar, 50).value = employee.address;                 cmd.parameters.add("@email", sqldbtype.nvarchar, 50).value = employee.email;                 cmd.parameters.add("@mobile", sqldbtype.nvarchar, 50).value = employee.mobile;                 cmd.parameters.add("@pincode", sqldbtype.nvarchar, 50).value = employee.pincode;                 cmd.parameters.addwithvalue("@vb", sqldbtype.bit).value = employee.vb;                 cmd.parameters.addwithvalue("@asp", sqldbtype.bit).value = employee.asp;                 cmd.parameters.addwithvalue("@gender", sqldbtype.int).value = employee.gender;                 conn.open();                 cmd.executenonquery();             }         } 

add parameter stored procedure call:

cmd.parameters.addwithvalue("@valueofradiobuttonr", sqldbtype.int).value = myradiobutton.value; 

in stored procedure on database, make sure handle parameter.


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -