15,921,959 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 Visual Basic questions
View Javascript 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 Devendra Dighe (Top 28 by date)
Devendra Dighe
23-Apr-14 9:52am
View
Hi Bh@gyesh ,
I tried your solution but in database it prints values prefix with N and in english
eg: it prints NDevendra,....
here are changes I made
cmd.Parameters.AddWithValue("@firstName", 'N'+txtName.Text);
cmd.Parameters.AddWithValue("@middleName", 'N'+txtMiddleName.Text);
cmd.Parameters.AddWithValue("@lastName", 'N'+txtSurname.Text);
cmd.Parameters.AddWithValue("@gender", 'N'+rdGender.SelectedValue);
and so on.
Devendra Dighe
23-Apr-14 3:02am
View
@Bh@gyesh: if i remove N from query then it converts data in english
Devendra Dighe
23-Apr-14 3:00am
View
if i remove N from query then it converts data in english
Devendra Dighe
23-Apr-14 2:52am
View
@ravikhoda : all my database fields are NVARCHAR
Devendra Dighe
21-Oct-13 3:16am
View
got the answer
Devendra Dighe
23-Apr-13 15:23pm
View
I havnt written the code yet. My problem is
i m having the texbox for usertype in the Access.aspx page and a button near the textbox
whenever i will click a button a popup window containing all usertypes from my user_master should be displayed . I ahould be able to select a usertype from that window .after selecting the usertype from popup window that value should be displayed in texbox in my access.aspx page
Devendra Dighe
20-Apr-13 8:42am
View
here is how i insert into texbox
cmd.Parameters.AddWithValue("reg_dt", DateFormat.SplitDateStringAndReturnObject(txtregdt.Text));
i have used date picker
for formating date i used following code
private class DateFormat
{
public static DateTime SplitDateStringAndReturnObject(string DateString)
{
if (DateString == "" || DateString == null)
{
int year = 9999;
int month = 1;
int day = 1;
DateTime dtObj = new DateTime(year, month, day);
return dtObj;
}
else
{
int len;
string[] datesplit = DateString.Split('/');
len = datesplit.Length;
if (len < 3)
{
datesplit = DateString.Split('-');
}
int year = Convert.ToInt32(datesplit[2]);
int month = Convert.ToInt32(datesplit[1]);
int day = Convert.ToInt32(datesplit[0]);
DateTime dtObj = new DateTime(year, month, day);
return dtObj;
}
}
}
Devendra Dighe
20-Apr-13 8:29am
View
this is my c# code
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.OleDb;
using System.Data.SqlClient;
public partial class Company_Master : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
/* lbluser.Text = Session["user_id"].ToString();
lbldiv.Text = Session["division_id"].ToString();
lblunit.Text = Session["unitcode"].ToString();
lblloyr.Text = Session["year"].ToString();
lbldate.Text = Session["date"].ToString();*/
}
Util.JQueryUtils.RegisterTextBoxForDatePicker(Page, txtregdt);
DataTable dt;
OleDbConnection conn = new OleDbConnection(ConfigurationManager.ConnectionStrings["vhgroupconnection"].ConnectionString);
OleDbCommand cmd1 = new OleDbCommand("SELECT cmp_id,cmp_name,reg_no,reg_dt,addr_line_1,addr_line_2,addr_line_3,pin_code,lst_no,cst_no,fax,phone,emailid FROM company_master ORDER BY cmp_id ASC", conn);
OleDbDataAdapter dA = new OleDbDataAdapter(cmd1);
dt = new DataTable();
dA.Fill(dt);
GridView1.DataSource = dt;
GridView1.DataBind();
Session["comp"] = dt;
GridView1.Visible = true;
}
protected void btnadd_Click(object sender, EventArgs e)
{
try
{
OleDbConnection myConnection = new OleDbConnection(ConfigurationManager.ConnectionStrings["vhgroupconnection"].ConnectionString);
string query = "INSERT INTO company_master(cmp_id,cmp_name,reg_no,reg_dt,addr_line_1,addr_line_2,addr_line_3,pin_code,lst_no,cst_no,fax,phone,emailid) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?)";
using (myConnection)
{
myConnection.Open();
using (OleDbCommand cmd = new OleDbCommand(query, myConnection))
{
cmd.CommandType = CommandType.Text;
cmd.Parameters.AddWithValue("cmp_id", txtcompid.Text);
cmd.Parameters.AddWithValue("cmp_name", txtcompname.Text);
cmd.Parameters.AddWithValue("reg_no", txtregno.Text);
cmd.Parameters.AddWithValue("reg_dt", DateFormat.SplitDateStringAndReturnObject(txtregdt.Text));
cmd.Parameters.AddWithValue("addr_line_1", txtaddr.Text);
cmd.Parameters.AddWithValue("addr_line_2", txtaddr1.Text);
cmd.Parameters.AddWithValue("addr_line_3", txtaddr2.Text);
cmd.Parameters.AddWithValue("pin_code" ,txtpin.Text);
cmd.Parameters.AddWithValue("lst_no",txtlocalsale.Text);
cmd.Parameters.AddWithValue("cst_no",txtcentraltxt.Text);
cmd.Parameters.AddWithValue("fax", txtfax.Text);
cmd.Parameters.AddWithValue("phone", txtphone.Text);
cmd.Parameters.AddWithValue("emailid", txtemail.Text);
cmd.ExecuteNonQuery();
}
myConnection.Close();
}
}
catch (Exception ex)
{
Response.Write("Error In An Application :" + ex.StackTrace + ex.Message);
}
}
private class DateFormat
{
public static DateTime SplitDateStringAndReturnObject(string DateString)
{
if (DateString == "" || DateString == null)
{
int year = 9999;
int month = 1;
int day = 1;
DateTime dtObj = new DateTime(year, month, day);
return dtObj;
}
else
{
int len;
string[] datesplit = D
Devendra Dighe
20-Apr-13 8:17am
View
whenever i click on particular row from the gridview
it shows the date but with time i only want date
Devendra Dighe
20-Apr-13 8:01am
View
i want to show it into the textbox
Devendra Dighe
20-Apr-13 1:55am
View
I ussed parametrized query but the query returns 0 it does not update the data
when i select row from gridview it shows both date & time in textbox but in database only date is stored
when i debugged code the date field showed 0 value
now how to solve this problem???
Devendra Dighe
19-Apr-13 16:32pm
View
System.Data.OleDb.OleDbException: No value given for one or more required parameters.
line 139 it showed error in executenonquery
Devendra Dighe
18-Apr-13 12:40pm
View
I GOt the answer i changed my update query as:
q = "UPDATE register SET passwd = '"+txtnewpass.Text+"' WHERE user_id ='"+txtuserid.Text+"'";
it worked successfully
thank you for your help
Devendra Dighe
18-Apr-13 10:26am
View
No my user_id is not integer its text
Devendra Dighe
17-Apr-13 15:06pm
View
@ThePhantomUpvoter: i changed the code but its now returning else part of the codeing i.e password was not changed its returning count=0
here is my update query
q = "UPDATE register SET passwd = @newPass WHERE user_id =@userid";
cmd = new OleDbCommand(q, myCon);
cmd.Parameters.AddWithValue("@userid", txtuserid.Text);
cmd.Parameters.AddWithValue("@newPasss", txtnewpass.Text);
int count = cmd.ExecuteNonQuery();
if (count > 0)
{
lblmsg.Text = "Password changed successfully";
}
else
{
lblmsg.Text = "password not changed";
}
Devendra Dighe
17-Apr-13 14:42pm
View
I m not getting solution
is thr anyother solution for the problem plz suggest me
Devendra Dighe
17-Apr-13 14:24pm
View
here is what i made chages but got exception ex {"Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done."} System.Exception {System.Data.OleDb.OleDbException}
my updated code is
OleDbConnection myCon = new OleDbConnection(ConfigurationManager.ConnectionStrings["vhgroupconnection"].ConnectionString);
myCon.Open();
string userid = txtuserid.Text;
string oldpass = txtoldpass.Text;
string newPass = txtnewpass.Text;
string conPass = txtconfirmpass.Text;
string q = "select user_id,passwd from register where user_id = @userid and passwd = @oldpass";
OleDbCommand cmd = new OleDbCommand(q, myCon);
cmd.Parameters.AddWithValue("@userid", txtuserid.Text);
cmd.Parameters.AddWithValue("@oldpass", txtoldpass.Text);
OleDbDataReader re = cmd.ExecuteReader();
re.Read();
if (re["user_id"].ToString() != String.Empty && re["passwd"].ToString() != String.Empty)
{
if (newPass.Trim() != conPass.Trim())
{
lblmsg.Text = "New Password and old password does not match";
}
else
{
q = "UPDATE register SET passwd = @newPass WHERE user_id =@userid";
cmd = new OleDbCommand(q, myCon);
cmd.Parameters.AddWithValue("@userid", txtuserid);
cmd.Parameters.AddWithValue("@newPasss", txtnewpass.Text);
//cmd.Parameters.AddWithValue("@userod", txtuserid.Text);
// cmd.Parameters.AddWithValue("@passwd", txtoldpass.Text);
int count = cmd.ExecuteNonQuery();
if (count > 0)
{
lblmsg.Text = "Password changed successfully";
}
else
{
lblmsg.Text = "password not changed";
}
in my database
user_id,passwd
Devendra Dighe
17-Apr-13 14:05pm
View
i tried it
but when i debugged the code it showed exception as
ex {"No value given for one or more required parameters."} System.Exception {System.Data.OleDb.OleDbException}
Devendra Dighe
16-Apr-13 15:50pm
View
Yesssss.............
Got it .............
Thank You very much Member9581488
Devendra Dighe
16-Apr-13 15:31pm
View
i debugged got i got exception in ex-specified cast is not valid for the line 118 resilt = (int)cmd.ExecuteScalar(); for this line
Devendra Dighe
16-Apr-13 15:26pm
View
i debugged got i got exception in ex-specified cast is not valid for the line 118 resilt = (int)cmd.ExecuteScalar(); for this line
Devendra Dighe
16-Apr-13 15:12pm
View
Here is the code which i updated , but no use still same problem it does not take me anywhere
string query = "SELECT user_id,passwd,empcode,dm.division_id,u.unitcode,sm.pc_code from register,division_master dm,unit_master u,sba_master sm where user_id=@user_id and passwd = @passwd and empcode = @empcode and division_id = @division_id and unitcode =@unitcode and pc_code =@pc_code";
int resilt = 0;
using (con)
{
con.Open();
using (OleDbCommand cmd = new OleDbCommand(query, con))
{
cmd.Parameters.AddWithValue("@user_id", Convert.ToString(txtuserid.Text));
cmd.Parameters.AddWithValue("@passwd", Convert.ToString(txtpass.Text));
cmd.Parameters.AddWithValue("@empcode", Convert.ToString(txtemp.Text));
cmd.Parameters.AddWithValue("division_id", Convert.ToString(div));
cmd.Parameters.AddWithValue("unitcode", Convert.ToString(unit));
cmd.Parameters.AddWithValue("pc_code", Convert.ToString(sba));
resilt = (int)cmd.ExecuteScalar();
}
con.Close();
Devendra Dighe
16-Apr-13 14:10pm
View
Deleted
which condition should i use in where clause
Devendra Dighe
16-Apr-13 14:08pm
View
Hello OriginalGriff, how to impliment membership can u help me in it
Devendra Dighe
16-Apr-13 14:05pm
View
which condition should i put in where clause
Devendra Dighe
16-Apr-13 13:50pm
View
no
Devendra Dighe
16-Apr-13 13:42pm
View
no error but does no redirect to home.aspx
Devendra Dighe
16-Apr-13 13:42pm
View
no error but it does no login and redirect to home.aspx
Show More