I'm using VS2010. I have Doubt
I create a database with name of TAX, Could you please send me a sample project? Base on the scenario. I don't know how to query and create stored procedures in MS SQL.. I just want to have an overview on which tables and fields are existing as per required by our DB Admin not to alter any table or alter any fields.
Tables : Fields
employee : employee_no[Primary Key], lastname , firstname
Document : DocumentId[Primary Key], employee_no[Foreign Key],Documentname,Documentpath
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.IO;
public partial class Form16UL : System.Web.UI.Page
{
private SqlConnection con = new SqlConnection("Data Source=gvipl2-pc;Initial Catalog=TAX;Integrated Security=True");
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnsubmit_Click(object sender, EventArgs e)
{
string filename = Path.GetFileName(fileUpload1.PostedFile.FileName);
fileUpload1.SaveAs(Server.MapPath("Form/" + filename));
con.Open();
SqlCommand cmd = new SqlCommand("insert into Document(DocumentName,DocumentPath) values(@DocumentName,@DocumentPath)", con);
cmd.Parameters.AddWithValue("@DocumentName", filename);
cmd.Parameters.AddWithValue("@DocumentPath", "Form/" + filename);
cmd.ExecuteNonQuery();
con.Close();
lblmsg.Text = "Thanx for uploading your form 16 file";
}
}

Sunny SharmaPosted Jun 4, 2013, 5:27 AM
I went through your code ans it all works absolutely fine. I suggest you to check with your table specification if you've assigned the proper data types for given columns (documentname,documentpath). if still the problem persists, share your project, I'll fix it.
Thanks.
Maniteja VegiPosted Jun 4, 2013, 3:48 AM
please tell me why this error come
Sunny SharmaPosted Jun 4, 2013, 3:46 AM
Sunny SharmaPosted Jun 4, 2013, 3:43 AM
Maniteja VegiPosted Jun 4, 2013, 3:26 AM
but i have a doubt in aspx.cs page
i mean in coding in webpage.aspx.cs
please tell me how to give code
Sunny SharmaPosted Jun 4, 2013, 2:31 AM
If you want to get started with SQL, start here:
http://w3schools.com/sql/
or if you want to learn Creating Stored Procedure, here is a nice go:
http://www.mssqltips.com/sqlservertutorial/160/sql-server-stored-procedure/
Hope it helps :)
Mark this as answer if it helps!
Thanks.