Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
class CustomerControler
{
[PostAction]
public void Add(Customer customer)
{
//save customer to database
}
}
class Customer
{
public string FirstName {get;set;}
public string LastName {get;set;}
}
Imports System.Data.SqlClient
Imports System.Data
Partial Class post
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Me.TextBox1.Text = Request.QueryString("PROP_DESC")
Me.TextBox2.Text = Request.QueryString("OCC_STAT")
Me.TextBox3.Text = Request.QueryString("PURCHASE_PRICE")
Dim conTest As SqlConnection
Dim strInsert As String
Dim cmdInsert As SqlCommand
conTest = New SqlConnection("Server=*****;UID=**;PWD=***;database=PostTest")
strInsert = "Insert dbo.Test (Property, Occupation, PurchasePrice) Values (@Property, @Occupation, @PurchasePrice)"
cmdInsert = New SqlCommand(strInsert, conTest)
cmdInsert.Parameters.AddWithValue("@Property", Me.TextBox1.Text)
cmdInsert.Parameters.AddWithValue("@Occupation", Me.TextBox2.Text)
cmdInsert.Parameters.AddWithValue("@PurchasePrice", Me.TextBox3.Text)
conTest.Open()
cmdInsert.ExecuteNonQuery()
conTest.Close()
End Sub
End Class
BIRTH_DATE=25%2F12%2F1956
Conversion failed when converting datetime from character string.
Stack Trace:
[SqlException (0x80131904): Conversion failed when converting datetime from character string.]
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +248
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +245
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +1357
System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +2971052
System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +2969457
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +423
System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) +537
System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +203
posttest.Page_Load(Object sender, EventArgs e) +1261
System.Web.UI.Control.OnLoad(EventArgs e) +133
System.Web.UI.Control.LoadRecursive() +66
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2604
var encodedvalue = Request.Params["date"];
var decodedvalue = HttpUtility
.HtmlDecode(encodedvalue);
var date = DateTime.Parse(decodedvalue);
command.AddParameterWithValue("key", date);