15,900,359 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by jayraj86 (Top 87 by date)
jayraj86
11-May-14 14:16pm
View
its not null.. i checked via response.write data is loading in dtt..
jayraj86
11-May-14 14:12pm
View
what ?
jayraj86
11-May-14 14:08pm
View
no its not null. i tried DropDownList4.SelectedItem.Text = Convert.ToString(dtt.Rows[0]["Branch"]); but it shows same error on same line
jayraj86
11-May-14 10:36am
View
I have one form which contains one file upload control. on page load i am loading all data from database into the respective textboxes of form.
I have one update button but on click my data is not updating. below is my code of update button
When i change image it gets updated but not other fields
jayraj86
11-May-14 10:28am
View
yes i m getting values in text boxes
jayraj86
8-May-14 4:29am
View
no error.. When i change image it gets updated but not other fields
jayraj86
8-May-14 4:18am
View
I tried writing Response.write("text") in else section but it doesnt show on click. I have not chosen any file to upload here
jayraj86
8-May-14 4:11am
View
Deleted
query is working
jayraj86
8-May-14 2:39am
View
thanks
jayraj86
8-May-14 1:06am
View
no..but it changes the layout and doesn't show paging at bottom
jayraj86
7-May-14 14:26pm
View
tried it changes entire view of gridview.. which i dont want
jayraj86
7-May-14 13:27pm
View
yes i debugged..
I am getting this error on first line of GridView2_RowDataBound which is
string str = " Category :" +........
jayraj86
7-May-14 12:17pm
View
:) Not able to solve this other problem - http://www.codeproject.com/Questions/768674/Paging-in-gridview-Specified-argument-was-out-of-t see if you can solve
jayraj86
7-May-14 12:05pm
View
Got it. Thanks a lot!
jayraj86
7-May-14 8:30am
View
Thanks a lot!!
jayraj86
7-May-14 8:25am
View
Nothing happens when I select this last radio button ;/
jayraj86
5-May-14 3:39am
View
Same thing i am loading in other page using same code and it works perfectly on other page
jayraj86
5-May-14 3:39am
View
Same thing i am loading in other page using same code and it works perfectly on other page
jayraj86
28-Apr-14 3:36am
View
here it is
protected void GridView2_RowDataBound(object sender, GridViewRowEventArgs e)
{
string str = "
Category
:" + e.Row.Cells[6].Text + "<br/>Duration :" + e.Row.Cells[4].Text + "<br/>InternshipCity :" + e.Row.Cells[5].Text + "<br/>Stipend :" + e.Row.Cells[7].Text + "<br/>InternshipStartDate :" + e.Row.Cells[2].Text + "<br/>ApplicationDeadline :" + e.Row.Cells[3].Text + "<br/>Required Degree :" + e.Row.Cells[9].Text + "<br/>Required Branch :" + e.Row.Cells[10].Text;
e.Row.Cells[1].Text = str;
//e.Row.Cells[1].Visible = false;
//e.Row.Cells[2].Visible = false;
e.Row.Cells[3].Visible = false;
e.Row.Cells[4].Visible = false;
e.Row.Cells[5].Visible = false;
e.Row.Cells[6].Visible = false;
e.Row.Cells[7].Visible = false;
e.Row.Cells[8].Visible = false;
e.Row.Cells[9].Visible = false;
e.Row.Cells[10].Visible = false;
e.Row.Cells[11].Visible = false;
e.Row.Cells[12].Visible = false;
e.Row.Cells[13].Visible = false;
if (GridView2.Rows.Count > 0)
{
GridView2.HeaderRow.Cells[0].Text = " ";
GridView2.HeaderRow.Cells[1].Text = " ";
GridView2.HeaderRow.Cells[2].Text = " ";
}
Image img = new Image();
img.ID = "abc";
img.ImageUrl = e.Row.Cells[0].Text;
e.Row.Cells[0].Controls.Add(img);
Button btn = new Button();
//btn.Text = "preview";
e.Row.Cells[2].Controls.Add(btn);
btn.CausesValidation = false;
btn.Text = "View and Apply";
if (Session.Count > 0)
{
btn.PostBackUrl = "Apply_internship.aspx?InternshipID=" + e.Row.Cells[8].Text + "&CompanyID=" + e.Row.Cells[11].Text + "&Title=" + e.Row.Cells[12].Text + "&CompanyName=" + e.Row.Cells[13].Text + "";
}
else
{
btn.PostBackUrl = "Apply_login.aspx";
}
}
jayraj86
28-Apr-14 3:34am
View
I tried that also but I'm getting same error
jayraj86
25-Apr-14 2:39am
View
I want to add a image between textbox and another image. like its in this link, on left side of email and password textbox.
jayraj86
19-Apr-14 0:48am
View
Error: Control 'GridView2' does not implement IPageableItemContainer.
jayraj86
18-Apr-14 10:55am
View
i'm getting this error "The data source does not support server-side data paging"
jayraj86
15-Apr-14 3:40am
View
Deleted
same error
jayraj86
15-Apr-14 3:39am
View
yes its returning
jayraj86
15-Apr-14 3:38am
View
i applied that code..same error
jayraj86
15-Apr-14 2:38am
View
protected void Recentinternship()
{
SqlConnection con = new SqlConnection("Data Source=jayraj-pc\\sqlexpress;Initial Catalog=Internship;Integrated Security=True;Pooling=False");
con.Open();
string str = "select B.CompanyLogo as ' ',A.Title,A.InternshipStartDate,A.ApplicationDeadline,A.Duration,A.InternshipCity,A.Category,A.Stipend,A.InternshipID,A.Degree,A.Branch,A.CompanyID,A.Title,A.CompanyName from Internship AS A INNER JOIN Companies AS B ON B.CompanyID=A.CompanyID ";
DataTable dt = new DataTable();
SqlCommand cmd = new SqlCommand(str, con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
//SqlDataReader dr = cmd.ExecuteReader();
da.Fill(dt);
if (dt.Rows.Count > 0)
{
GridView2.DataSource = dt;
GridView2.DataBind();
}
//GridView2.BottomPagerRow.Visible = true;
con.Close();
}
I changed code to like this but the problem i am getting is no data is loding in gridview.
jayraj86
15-Apr-14 2:36am
View
protected void Recentinternship()
{
SqlConnection con = new SqlConnection("Data Source=jayraj-pc\\sqlexpress;Initial Catalog=Internship;Integrated Security=True;Pooling=False");
con.Open();
string str = "select B.CompanyLogo as ' ',A.Title,A.InternshipStartDate,A.ApplicationDeadline,A.Duration,A.InternshipCity,A.Category,A.Stipend,A.InternshipID,A.Degree,A.Branch,A.CompanyID,A.Title,A.CompanyName from Internship AS A INNER JOIN Companies AS B ON B.CompanyID=A.CompanyID ";
DataTable dt = new DataTable();
SqlCommand cmd = new SqlCommand(str, con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
//SqlDataReader dr = cmd.ExecuteReader();
da.Fill(dt);
if (dt.Rows.Count > 0)
{
GridView2.DataSource = dt;
GridView2.DataBind();
}
//GridView2.BottomPagerRow.Visible = true;
con.Close();
}
I changed code to like this but the problem i am getting is no data is loding in gridview.
jayraj86
15-Apr-14 2:12am
View
done.. same error!
jayraj86
15-Apr-14 1:43am
View
Same error
jayraj86
10-Apr-14 9:33am
View
one other problem i m stuck at right now, can you sort it out ?
here is the link http://www.codeproject.com/Questions/756411/In-Asp-Net-Csharp-I-Have-Four-Dropdownlist-And-I-W
jayraj86
10-Apr-14 9:32am
View
Yeah I got it later about that cmd thing, btw thank you so much RaajKumar :))
one other problem i m stuck at right now, can you sort it out ?
here is the link http://www.codeproject.com/Questions/756411/In-Asp-Net-Csharp-I-Have-Four-Dropdownlist-And-I-W
jayraj86
10-Apr-14 9:29am
View
Thanks a lot. I never thought about that :)
jayraj86
10-Apr-14 3:22am
View
Thanks a lot RaajKumar. it was just a small mistake, cmd2 instead of cmd in 3rd last line.
jayraj86
10-Apr-14 3:01am
View
Thanks a lot RaajKumar. it was just a small mistake, cmd2 instead of cmd in 3rd last line :)
jayraj86
10-Apr-14 2:48am
View
yes its filling gridview
jayraj86
10-Apr-14 2:43am
View
yes its filling gridview
jayraj86
10-Apr-14 2:42am
View
Yes its gridview is filling with userid and firstname
jayraj86
10-Apr-14 2:37am
View
not working
jayraj86
10-Apr-14 2:31am
View
I checked it by writing Response.Write("dfd"); below da.Fill(dt);
and its showing dfd at corner
jayraj86
10-Apr-14 2:26am
View
i removed ... from insert query. no I'm not getting any error.
jayraj86
10-Apr-14 2:16am
View
qlConnection con = new SqlConnection("Data Source=jayraj-pc\\sqlexpress;Initial Catalog=Internship;Integrated Security=True;Pooling=False");
con.Open();
SqlCommand cmd = new SqlCommand("select UserID,FirstName from Users where UserID='" + Session["UserID"].ToString() + "'", con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);
for (int i = 0; i < dt.Rows.Count; i++)
{
SqlCommand cmd2 = new SqlCommand("insert into UsersApplied values('" + dt.Rows[0][0].ToString() + "','" + dt.Rows[0][1].ToString() + "',......) ", con);
cmd.ExecuteNonQuery();
}
con.Close();
I applied this code but i m not getting any data in AppliedUsers table. why ?
jayraj86
10-Apr-14 2:16am
View
Deleted
SqlConnection con = new SqlConnection("Data Source=jayraj-pc\\sqlexpress;Initial Catalog=Internship;Integrated Security=True;Pooling=False");
con.Open();
SqlCommand cmd = new SqlCommand("select UserID,FirstName from Users where UserID='" + Session["UserID"].ToString() + "'", con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);
for (int i = 0; i < dt.Rows.Count; i++)
{
SqlCommand cmd2 = new SqlCommand("insert into UsersApplied values('" + dt.Rows[0][0].ToString() + "','" + dt.Rows[0][1].ToString() + "',......) ", con);
cmd.ExecuteNonQuery();
}
con.Close();
I applied this code but i m not getting any data in AppliedUsers table. why ?
jayraj86
10-Apr-14 2:08am
View
Appreciate your answer Raajkumar,
how can I write insert query here ?
INSERT INTO UsersApplied (UserID,FirstName)Values (???)
what should i write in values ??
jayraj86
10-Apr-14 1:56am
View
I have tables
1.Users
2.AppliedUsers
in AppliedUsers table I have few 6-7 columns which are same as in Users table. As I want those values from Users table and store those values in this new AppliedUsers table.
I have stored UserID (from users table) value in session, the thing I am doing here is on button click i want to store selected values from Users into AppliedUsers table where UserId=session[userid]. The user is applying for job on button click and i want to store the data of that user who applied into this new AppliedUsers table from Users table.
jayraj86
8-Apr-14 4:16am
View
This is my on button click code what changes should i make in this code ??
SqlConnection con = new SqlConnection("Data Source=jayraj-pc\\sqlexpress;Initial Catalog=Internship;Integrated Security=True;Pooling=False");
con.Open();
//if (Degree2.SelectedIndex > 0 && branch2.SelectedIndex > 0 && DropDownList1.SelectedIndex > 0 && DropDownList2.SelectedIndex > 0)
//{
string str = "select B.CompanyLogo as ' ',A.Title,A.InternshipStartDate,A.ApplicationDeadline,A.Duration,A.InternshipCity,A.Category,A.Stipend,A.InternshipID,A.Degree,A.Branch from Internship AS A INNER JOIN Companies AS B ON A.CompanyID=B.CompanyID where (Degree='" + Degree2.SelectedItem.Text + "' and Branch='" + branch2.SelectedItem.Text + "') or InternshipCity ='" + DropDownList1.SelectedItem.Text + "' or Category='" + DropDownList2.SelectedItem.Text + "'";
Response.Write(str);
SqlCommand cmd = new SqlCommand(str, con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
SqlDataReader dr = cmd.ExecuteReader();
GridView2.DataSource = dr;
GridView2.DataBind();
//Response.Write(GridView2.Columns.Count.ToString());
con.Close();
jayraj86
6-Apr-14 6:01am
View
can you please provide code for this ?
jayraj86
6-Apr-14 5:36am
View
I saw 2nd link but i have not used stored procedure,I used default sql server of visual studio. so what changes i should made in that code ?
jayraj86
2-Apr-14 6:27am
View
I am already loading it on !IsPostBack
jayraj86
1-Apr-14 7:52am
View
string i checked, its okay. I am not having problem in cascading dropdownlist. the problem is in loadinternshipdata() function. where i am just loading data from table (editing profile, which shows all registered data in respective textboxes).
jayraj86
1-Apr-14 7:32am
View
actually it is degree and branch in place of country and city
protected void BindDegreedropdown()
{
//conenction path for database
SqlConnection con = new SqlConnection("Data Source=jayraj-pc\\sqlexpress;Initial Catalog=Internship;Integrated Security=True;Pooling=False");
con.Open();
SqlCommand cmd = new SqlCommand("select * from Degree", con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
con.Close();
DropDownList3.DataSource = ds;
DropDownList3.DataTextField = "DegreeName";
DropDownList3.DataValueField = "DegreeID";
DropDownList3.DataBind();
DropDownList3.Items.Insert(0, new ListItem("--Select--", "0"));
//branch1.Items.Insert(0, new ListItem("--Select--", "0"));
}
protected void DropDownList3_SelectedIndexChanged(object sender, EventArgs e)
{
int DegreeID = Convert.ToInt32(DropDownList3.SelectedValue);
SqlConnection con = new SqlConnection("Data Source=jayraj-pc\\sqlexpress;Initial Catalog=Internship;Integrated Security=True;Pooling=False");
con.Open();
SqlCommand cmd = new SqlCommand("select * from Branch where DegreeID=" + DegreeID, con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
con.Close();
DropDownList4.DataSource = ds;
DropDownList4.DataTextField = "BranchName";
DropDownList4.DataValueField = "BranchID";
DropDownList4.DataBind();
DropDownList4.Items.Insert(0, new ListItem("--Select--", "0"));
//if (DropDownList2.SelectedValue == "0")
//{
// DropDownList3.Items.Clear();
// DropDownList3.Items.Insert(0, new ListItem("--Select--", "0"));
//}
}
jayraj86
1-Apr-14 7:02am
View
Deleted
I have one registration form. I have made cascading dropdownlist in which data of state dropdownlist is loaded on selected index change of Country. sql database is having table Country and State.
I am loading all data(other page, like here it is edit profile) which was submitted during registration on page load event at respective textboxes and dropdownlist. The problem is that Country is loading perfectly on country dropdown but the value of respective state is not loading on state drop down.
code that i am using is as below
protected void loadinternshipdata()
{
SqlConnection con = new SqlConnection("Data Source=ja-pc\\sqlexpress;Initial Catalog=Internship;Integrated Security=True;Pooling=False");
con.Open();
SqlCommand cmd3 = new SqlCommand("select * from Internship where CompanyID=" + Convert.ToInt16(Session["CompanyID"].ToString()), con);
SqlDataAdapter daa = new SqlDataAdapter(cmd3);
DataTable dtt = new DataTable();
daa.Fill(dtt);
if (dtt.Rows.Count > 0)
{
DropDownList3.SelectedItem.Text = dtt.Rows[0]["Country"].ToString();
DropDownList4.SelectedItem.Text = dtt.Rows[0]["State"].ToString();
}
}
jayraj86
1-Apr-14 7:01am
View
Deleted
I have one registration form. I have made cascading dropdownlist in which data of state dropdownlist is loaded on selected index change of Country. sql database is having table Country and State.
I am loading all data(other page, like here it is edit profile) which was submitted during registration on page load event at respective textboxes and dropdownlist. The problem is that Country is loading perfectly on country dropdown but the value of respective state is not loading on state drop down.
code that i am using is as below
protected void loadinternshipdata()
{
SqlConnection con = new SqlConnection("Data Source=ja-pc\\sqlexpress;Initial Catalog=Internship;Integrated Security=True;Pooling=False");
con.Open();
SqlCommand cmd3 = new SqlCommand("select * from Internship where CompanyID=" + Convert.ToInt16(Session["CompanyID"].ToString()), con);
SqlDataAdapter daa = new SqlDataAdapter(cmd3);
DataTable dtt = new DataTable();
daa.Fill(dtt);
if (dtt.Rows.Count > 0)
{
DropDownList3.SelectedItem.Text = dtt.Rows[0]["Country"].ToString();
DropDownList4.SelectedItem.Text = dtt.Rows[0]["State"].ToString();
}
}
jayraj86
26-Mar-14 2:51am
View
YES "show sub-menu on hover". i want the same using CSS
jayraj86
14-Mar-14 12:04pm
View
the case here is the user who get's logged in only his/her photo should be displayed.
jayraj86
14-Mar-14 11:57am
View
My code is as below. I just want to display image on page load. i am using image control. what changes i should make in this code ?
protected void Page_Load(object sender, EventArgs e)
{
if (Convert.ToInt16(Session["CompanyID"].ToString()) > 0)
{
con.Open();
SqlCommand cmd = new SqlCommand("select * from Companies where CompanyID=" + Session["CompanyID"], con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds, "Companies");
if (ds.Tables[0].Rows.Count > 0)
{
email.Text = ds.Tables[0].Rows[0]["EmailID"].ToString();
firstname.Text = ds.Tables[0].Rows[0]["FirstName"].ToString();
lastname.Text = ds.Tables[0].Rows[0]["LastName"].ToString();
designation.Text = ds.Tables[0].Rows[0]["Designation"].ToString();
mobile.Text = ds.Tables[0].Rows[0]["ContactNo"].ToString();
Label9.Text = ds.Tables[0].Rows[0]["CompanyName"].ToString();
Label10.Text = ds.Tables[0].Rows[0]["City"].ToString();
Label16.Text = ds.Tables[0].Rows[0]["Address"].ToString();
Label11.Text = ds.Tables[0].Rows[0]["Website"].ToString();
Label12.Text = ds.Tables[0].Rows[0]["CompanyCategory"].ToString();
Label13.Text = ds.Tables[0].Rows[0]["NoOfEmployees"].ToString();
Label15.Text = ds.Tables[0].Rows[0]["Aboutcompany"].ToString();
}
}
}
}
}
jayraj86
14-Mar-14 11:56am
View
Thanks.. but I am using session so I want image as per session id.
jayraj86
14-Mar-14 11:52am
View
I have added image control.. will you please write that in code ?
jayraj86
14-Mar-14 11:49am
View
My code is as below. I just want to display image on page load. i am using image control. what changes i should make in this code ?
protected void Page_Load(object sender, EventArgs e)
{
if (Convert.ToInt16(Session["CompanyID"].ToString()) > 0)
{
con.Open();
SqlCommand cmd = new SqlCommand("select * from Companies where CompanyID=" + Session["CompanyID"], con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds, "Companies");
if (ds.Tables[0].Rows.Count > 0)
{
email.Text = ds.Tables[0].Rows[0]["EmailID"].ToString();
firstname.Text = ds.Tables[0].Rows[0]["FirstName"].ToString();
lastname.Text = ds.Tables[0].Rows[0]["LastName"].ToString();
designation.Text = ds.Tables[0].Rows[0]["Designation"].ToString();
mobile.Text = ds.Tables[0].Rows[0]["ContactNo"].ToString();
Label9.Text = ds.Tables[0].Rows[0]["CompanyName"].ToString();
Label10.Text = ds.Tables[0].Rows[0]["City"].ToString();
Label16.Text = ds.Tables[0].Rows[0]["Address"].ToString();
Label11.Text = ds.Tables[0].Rows[0]["Website"].ToString();
Label12.Text = ds.Tables[0].Rows[0]["CompanyCategory"].ToString();
Label13.Text = ds.Tables[0].Rows[0]["NoOfEmployees"].ToString();
Label15.Text = ds.Tables[0].Rows[0]["Aboutcompany"].ToString();
}
}
}
}
}
jayraj86
13-Mar-14 4:23am
View
Datatype of image is nvarchar(MAX)
jayraj86
13-Mar-14 4:21am
View
I want to fetch image on page load from table in which the path of image is stored and the actual image is in the folder of solution. I have used image control. should i use another control ?
jayraj86
12-Mar-14 12:15pm
View
Thanks but the problem has been solved!
jayraj86
12-Mar-14 4:16am
View
how to make changes in this code ?
jayraj86
12-Mar-14 1:00am
View
I can send you aspx and cs file but database file is bit large.
jayraj86
11-Mar-14 9:24am
View
not working
jayraj86
11-Mar-14 8:54am
View
Same error ;\
jayraj86
11-Mar-14 8:13am
View
currentpassword.Text "123" string
ds.Tables[0].Rows[0]["Password"] "123 "object {string}
jayraj86
11-Mar-14 8:04am
View
same error
Please enter correct Current password
jayraj86
11-Mar-14 7:58am
View
and warning on line if(currentpassword.Text ==ds.Tables[0].Rows[0]["password"])
Possible unintended reference comparison; to get a value comparison, cast the right hand side to type 'string'
jayraj86
11-Mar-14 7:52am
View
Same error !!
jayraj86
11-Mar-14 7:36am
View
The name 'Val' does not exist in current context
jayraj86
10-Mar-14 4:29am
View
error in second last line on con.close();
'the name 'con' does not exist in current context'
jayraj86
10-Mar-14 2:03am
View
can you write that code ?
jayraj86
9-Mar-14 6:38am
View
here is update code. everything other than photo gets updated
protected void updatecompany_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection("Data Source=jayraj-pc\\sqlexpress;Initial Catalog=Internship;Integrated Security=True;Pooling=False");
string sql = "UPDATE Companies SET FirstName=@val1, LastName=@val2, UserName=@val3, EmailID=@val4, Password=@val5, ConfirmPassword=@val6, CompanyName=@val7, Designation=@val8, ContactNo=@val9, Country=@val10, State=@val11, City=@val12, CompanyCategory=@val13, NoOfEmployees=@val14, Website=@val15, Aboutcompany=@val16, Address=@val17, CompanyLogo=@val18 where CompanyID=" + Convert.ToInt16(Request.QueryString["CompanyID"].ToString());
try
{
con.Open();
SqlCommand cmd = new SqlCommand(sql, con);
string filepath = Server.MapPath("~/CompanyLogo/" + strFileName);
string path = "~/CompanyLogo/" + strFileName;
cmd.Parameters.AddWithValue("@Val1", firstname.Text);
cmd.Parameters.AddWithValue("@Val2", lastname.Text);
cmd.Parameters.AddWithValue("@Val3", cusername.Text);
cmd.Parameters.AddWithValue("@Val4", email.Text);
cmd.Parameters.AddWithValue("@Val5", password.Text);
cmd.Parameters.AddWithValue("@Val6", cnfpass.Text);
cmd.Parameters.AddWithValue("@Val7", companyname.Text);
cmd.Parameters.AddWithValue("@Val8", designation.Text);
cmd.Parameters.AddWithValue("@Val9", mobileno.Text);
cmd.Parameters.AddWithValue("@Val10", countrylist.SelectedItem.Text);
cmd.Parameters.AddWithValue("@Val11", statelist.SelectedItem.Text);
cmd.Parameters.AddWithValue("@Val12", city.SelectedItem.Text);
cmd.Parameters.AddWithValue("@Val13", companysector.SelectedItem.Text);
cmd.Parameters.AddWithValue("@Val14", DropDownList5.SelectedItem.Text);
cmd.Parameters.AddWithValue("@Val15", website.Text);
cmd.Parameters.AddWithValue("@Val16", aboutcompany.Text);
cmd.Parameters.AddWithValue("@Val17", address.Text);
cmd.Parameters.AddWithValue("@Val18", path);
cmd.CommandType = CommandType.Text;
cmd.ExecuteNonQuery();
}
catch (System.Data.SqlClient.SqlException ex)
{
string msg = "Insert Error:";
msg += ex.Message;
throw new Exception(msg);
}
finally
{
con.Close();
}
}
jayraj86
9-Mar-14 5:46am
View
here it is
protected void updatecompany_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection("xyz...");
con.Open();
string filepath = Server.MapPath("~/CompanyLogo/" + strFileName);
string path = "~/CompanyLogo/" + strFileName;
string str = "UPDATE Companies set CompanyLogo='" + path +"' where CompanyID=" + Convert.ToInt16(Request.QueryString["CompanyID"].ToString());
SqlCommand cmd = new SqlCommand(str, con);
cmd.ExecuteNonQuery();
con.Close();
}
jayraj86
9-Mar-14 5:30am
View
This is insert code
SqlConnection con = new SqlConnection("Data Source=jayraj-pc\\sqlexpress;Initial Catalog=Internship;Integrated Security=True;Pooling=False");
string sql = "INSERT INTO Companies (CompanyLogo) VALUES (@Val1)";
try
{
con.Open();
SqlCommand cmd = new SqlCommand(sql, con);
string filepath = Server.MapPath("~/CompanyLogo/" + strFileName);
string path = "~/CompanyLogo/" + strFileName;
cmd.Parameters.AddWithValue("@Val1", path);
cmd.CommandType = CommandType.Text;
cmd.ExecuteNonQuery();
}
catch (System.Data.SqlClient.SqlException ex)
{
string msg = "Insert Error:";
msg += ex.Message;
throw new Exception(msg);
}
finally
{
con.Close();
}
}
}
}
jayraj86
9-Mar-14 5:09am
View
Thanks, man! I just changed the code to parameterized. now how I can use it to update a photo ?
jayraj86
7-Mar-14 12:00pm
View
No. I'm just a beginner
jayraj86
7-Mar-14 11:35am
View
I'm not getting you.. how to make changes i this code to update ?
jayraj86
7-Mar-14 11:25am
View
Check the username and password textboxes of gmail's sign up(add new account) page
jayraj86
7-Mar-14 10:28am
View
not working ;/
jayraj86
7-Mar-14 10:28am
View
not working ;/
jayraj86
7-Mar-14 1:07am
View
Thank you Pranav.
jayraj86
7-Mar-14 0:50am
View
Thank you so much! :)
jayraj86
6-Mar-14 8:06am
View
Exactly same code works perfectly on other form page but not in this one page.
jayraj86
6-Mar-14 6:02am
View
No.
jayraj86
6-Mar-14 5:52am
View
No, I'm not getting any errors. the thing is when I select Country from countrylist dropdown the page doesn't refresh which should as it's auto post back. States are not coming in statelist dropdown.
Show More