the cracker 0 Report post Posted April 13, 2008 ni coding aku...using System;using System.Data;using System.Data.SqlClient;using System.Configuration;using System.Collections;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Web.UI.HtmlControls;public partial class createUser : System.Web.UI.Page{ protected void Page_Load(object sender, EventArgs e) { } protected void subButton_Click(object sender, EventArgs e) { String connectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; SqlConnection connection = new SqlConnection(connectionString); SqlCommand cmd = new SqlCommand(@"INSERT INTO loginData(UserId,staffName,staffDepartment,staffEmail) VALUES(@UserId,@staffName,@staffDepartment,@staffEmail)", connection); cmd.Parameters.Add("@UserId", SqlDbType.UniqueIdentifier).Value = usernameText.Text; cmd.Parameters.Add("@staffName", SqlDbType.NVarChar, 50).Value = nameText.Text; cmd.Parameters.Add("@staffDepartment", SqlDbType.NVarChar, 50).Value = deptText.Text; cmd.Parameters.Add("@staffEmail", SqlDbType.NVarChar, 50).Value = emailText.Text; connection.Open(); int i = cmd.ExecuteNonQuery(); connection.Close(); } }dpt error ni bile run.. System.InvalidCastException: Invalid cast from 'System.String' to 'Sy Quote Share this post Link to post Share on other sites
the cracker 0 Report post Posted April 13, 2008 hehe da settle.. Quote Share this post Link to post Share on other sites