15,898,134 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 VandrenSKL (Top 16 by date)
VandrenSKL
7-Mar-16 3:56am
View
For the code i show is only able to export all not selected user. Please advice?
VandrenSKL
7-Mar-16 3:47am
View
Yeah as so far, is worked as so far i thought needed to modify at button there but actually is page load. thanks guys
VandrenSKL
29-Feb-16 2:34am
View
Hi, is it the source code tab design in visual that you mention?
VandrenSKL
25-Feb-16 5:24am
View
Deleted
public partial class DatabaseEntry : System.Web.UI.Page
{
public string strConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
string str;
SqlCommand com;
protected void Page_Load(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(strConnString);
con.Open();
str = ("select * from AspNetUsers where UserName = ('" + Session["UserName"] + "')");
com = new SqlCommand(str, con);
object obj = Session["UserName"];
SqlDataReader reader = com.ExecuteReader();
reader.Read();
Label1.Text = reader["UserName"].ToString();
if (!this.IsPostBack)
{
this.BindGrid();
}
}
.............
}
This is my page load code, still can't find where's the bugs as all column and data are match?
VandrenSKL
30-Apr-15 4:16am
View
I'm getting this error after add into the line before the fill()
"ExecuteReader: CommandText property has not been initialized"
VandrenSKL
28-Apr-15 3:19am
View
Sorry, I'm getting this error "The SelectCommand property has not been initialized before calling 'Fill'."
Below are my code:
protected void Button7_Click(object sender, EventArgs e)
{
string connectionString = "Data Source=.\\SQLEXPRESS;"
+ "AttachDbFilename=\"C:\\Users\\KLSIT\\Documents\\Visual Studio 2008\\Projects\\WebPortal\\WebPortal\\App_Data\\emaildata.mdf\";"
+ "Integrated Security=True;"
+ "Connect Timeout=30;"
+ "User Instance=True";
System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(connectionString);
System.Data.SqlClient.SqlCommand cmd = conn.CreateCommand();
// SqlCommand cd = new SqlCommand("EmailDup", conn);
{
String FullName;
String FirstName;
String LastName;
String email = TextBox3.Text.Trim();
String select = select ID from Customer where email=@email limit 1;
cmd.Parameters.AddWithValue("@email", email);
DataTable dt = new DataTable();
SqlDataAdapter da = new SqlDataAdapter();
da.Fill(dt);
if (dt.Rows.Count > 0)
{
ScriptManager.RegisterStartupScript(this, this.GetType(), "popup", "alert('Emailid exists')", true);
return;
}
cmd.Parameters.Add("Type", SqlDbType.NVarChar);
cmd.Parameters["Type"].Value = this.DropDownList2.Text;
cmd.Parameters.Add("Title", SqlDbType.NVarChar);
cmd.Parameters["Title"].Value = this.DropDownList1.Text;
cmd.Parameters.Add("FirstName", SqlDbType.NVarChar);
cmd.Parameters["FirstName"].Value = this.TextBox1.Text;
cmd.Parameters.Add("LastName", SqlDbType.NVarChar);
cmd.Parameters["LastName"].Value = this.TextBox2.Text;
cmd.Parameters.Add("Fullname", SqlDbType.NVarChar);
cmd.Parameters["Fullname"].Value = this.TextBox1.Text + " " + this.TextBox2.Text;
//cmd.Parameters["Email"].Value = this.TextBox3.Text.Trim();
cmd.Parameters.Add("Job_Title", SqlDbType.NVarChar);
cmd.Parameters["Job_Title"].Value = this.TextBox4.Text;
cmd.Parameters.Add("Company", SqlDbType.NVarChar);
cmd.Parameters["Company"].Value = this.TextBox5.Text;
cmd.Parameters.Add("Mobile_Phone", SqlDbType.NVarChar);
cmd.Parameters["Mobile_Phone"].Value = this.TextBox6.Text;
cmd.Parameters.Add("Office_Phone", SqlDbType.NVarChar);
cmd.Parameters["Office_Phone"].Value = this.TextBox7.Text;
cmd.Parameters.Add("Staff", SqlDbType.NVarChar);
cmd.Parameters["Staff"].Value = this.Label1.Text;
FirstName = TextBox1.Text;
LastName = TextBox2.Text;
FullName = TextBox1.Text + " " + TextBox2.Text;
cmd.CommandText = "INSERT INTO [Customer] ([Type], [Title], [Firstname], [Lastname], [Fullname], [Company], [Email], [Mobile_Phone], [Office_Phone], [Job_Title], [Staff]) VALUES (@Type, @Title, @Firstname, @Lastname, @Fullname, @Company, @Email, @Mobile_Phone, @Office_Phone, @Job_Title, @Staff)";
try
{
conn.Open();
cmd.ExecuteNonQuery();
ScriptManager.RegisterStartupScript(this, this.GetType(), "popup", "alert('Record Saved Successfully.');window.location='DataEntry.aspx';", true);
}
catch (Exception ex)
{
VandrenSKL
27-Apr-15 2:57am
View
yes it doesn't checking on it and still allowing insert data
VandrenSKL
24-Apr-15 3:54am
View
Hi,
still not success.
Should I use if else?
As it's still able to submit the data without checking it. I just need to pop out the message after submit and it will check it and not allow to submit.
VandrenSKL
24-Apr-15 0:55am
View
Hi guys,
I able to submit the data into database but how to display if any duplicate data especially email?
VandrenSKL
24-Apr-15 0:54am
View
Hi Webmaster442,
which line do i need to put?
is it under here?
try
{
conn.Open();
cmd.ExecuteNonQuery();
ScriptManager.RegisterStartupScript(this, this.GetType(), "popup", "alert('Record Saved Successfully.');window.location='DataEntry.aspx';", true);
}
catch (Exception ex)
{
*CHANGE THIS?*>>>>> Response.Write("Oops!! Following error occured: " + ex.Message.ToString());
}
finally
{
conn.Close();
cmd.Dispose();
}
VandrenSKL
17-Apr-15 5:43am
View
Sorry, just ignore the DataItemIndex. Which code suppose I put? as all textbox, dropdownlist, those able to put .text but detailsview is not able to put it.
As i had recall the data from Staff table into Customer table.
VandrenSKL
17-Apr-15 3:16am
View
Sorry, just ignore the DataItemIndex. Which code suppose I put? as all textbox, dropdownlist, those able to put .text but detailsview is not able to put it.
As i had recall the data from Staff table into Customer table.
VandrenSKL
17-Apr-15 3:01am
View
yes, sorry for that my wrong as I want display username not numeric. Confusing of it.
VandrenSKL
17-Apr-15 3:00am
View
yes it's come out the result is in numeric, not the user name. That's why I'm confusing this, how to code it.
VandrenSKL
16-Apr-15 12:11pm
View
Hi bro,
the value in the cmd.Parameters["Staff"] is the name of the user.
It will display on the data entry page after login. I want make sure that whoever key in the data, we can able to know whose key in and both are different table.
thank you
VandrenSKL
16-Apr-15 11:52am
View
this line:
cmd.Parameters.AddWithValue("Staff";, SqlDbType.NVarChar);
cmd.Parameters["Staff"].Value = this.DetailsView2.DataItemIndex;
Others field able to goes into database after user key in the textbox.
For the detailsview, it will display the username from Staff table. How to make it insert into Customer table?
thank you
Show More