When I execute this, it works ok but only one the first character of the request.form["d"] is stored to the db.
I checked the sproc with another routine and it adds full data, and I've verified that value of request.form["d"] is longer than one chaacter by printing it to the page. Anyone got any ideas why only the first char is getting added to the db??
SqlConnection SqlConnection1 =new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString1"].ConnectionString);SqlCommand SqlCommand1 =new SqlCommand("addRoute", SqlConnection1);SqlCommand1.CommandType = CommandType.StoredProcedure;SqlParameter SqlParameter1 = SqlCommand1.Parameters.Add("@.ReturnValue", SqlDbType.Int);SqlParameter1.Direction = ParameterDirection.ReturnValue;SqlCommand1.Parameters.Add("@.xmlData", Request.Form["d"]);SqlConnection1.Open();SqlCommand1.ExecuteNonQuery();Response.Write(SqlCommand1.Parameters["@.ReturnValue"].Value);//Response.Write(Request.Form["d"]);
Here's my stored procedure too....
CREATE PROCEDURE [mydatabase].[addRoute]@.xmlDatavarcharASSET NOCOUNT ONINSERT INTO tbl_routes(xmldata)VALUES(@.xmlData)SELECT scope_identity()RETURN scope_identity()SET NOCOUNT OFF
|||
You need to set the size of the parameter. By default it takes only one character.
@.xmlDatavarchar(50)
No comments:
Post a Comment