helloI have a class below which calls a SP. But in the datetime value, it gives an errorAny advice on thisBelow is my class and .net c# web page. Error line is in red below.thanksEhi <form id="form1" runat="server"> <div> <asp:TextBox ID="username" runat="server"></asp:TextBox> <asp:TextBox ID="First_Name" runat="server"></asp:TextBox> <asp:TextBox ID="dob" runat="server"></asp:TextBox> <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" /> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> </div> </form>
and here is my code in my class command.Parameters.Add(new SqlParameter("@usernames", SqlDbType.Int, 0, "RegionID")); command.Parameters.Add(new SqlParameter("@username", SqlDbType.VarChar, 20, "username")); command.Parameters.Add(new SqlParameter("@First_Name", SqlDbType.VarChar, 50, "First_Name")); command.Parameters.Add(new SqlParameter("@Last_Name", SqlDbType.VarChar, 50, "Last_Name")); command.Parameters.Add(new SqlParameter("@dob", SqlDbType.Date, 50, "dob")); command.Parameters[0].Value = 4; command.Parameters[1].Value = "username"; command.Parameters[2].Value = "First_Name"; command.Parameters[3].Value = "Last_Name"; command.Parameters[4].Value = DateTime.Parse(dob.Text);