16,012,223 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 .NET 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 Member 9693583 (Top 20 by date)
Member 9693583
4-Jan-13 6:00am
View
Thanks madhuri... its working while running stored procedure but query giving me below error.. pls help
Query code
USE CRM;
GO
EXECUTE Allocate_call @comp_no, @Tech_name;
& error is
Msg 137, Level 15, State 2, Line 1
Must declare the scalar variable "@comp_no".
Member 9693583
4-Jan-13 5:09am
View
Yes I want to do this only bt having problem in procedure... error occured that procedure Allocation_call not found.. even though i was created it.
See my front end coding.... actually i want to select complaint no. from 1 dropdownlist(which comes from databse only) & Tech_name from another dropdownlist(which comes from database only) and insert the particular record of selected complaint no. in along with Tech_name in another table on button click
Code for ur reference
SqlConnection con;
SqlCommand cmd;
SqlDataReader dr;
private string s;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
ddlComplaint.Items.Insert(0, new ListItem("---Select---", "---Select---"));
FillDropDownList();
ddlAllow.Items.Insert(0, new ListItem("---Select---", "---Select---"));
FillTechnicianDropDownList();
}
}
// Fill Dropdownlist
public void FillDropDownList()
{
s = WebConfigurationManager.ConnectionStrings["Callregister_connectionstring"].ConnectionString;
con = new SqlConnection(s);
con.Open();
cmd = new SqlCommand("Select Complaint_no from Call_Reg where Status='Open'" , con);
dr = cmd.ExecuteReader();
while (dr.Read())
{
ddlComplaint.Items.Add(dr[0].ToString());
}
dr.Close();
con.Close();
}
// Show data in GridView
protected void btnSearch_Click(object sender, EventArgs e)
{
s = WebConfigurationManager.ConnectionStrings["Callregister_connectionstring"].ConnectionString;
con = new SqlConnection(s);
con.Open();
cmd = new SqlCommand("Select * from Call_Reg where Complaint_no='" + ddlComplaint.SelectedItem.ToString() + "'", con);
dr = cmd.ExecuteReader();
GridView2.DataSource = dr;
GridView2.DataBind();
dr.Close();
con.Close();
}
// Fill Technician
public void FillTechnicianDropDownList()
{
s = WebConfigurationManager.ConnectionStrings["Callregister_connectionstring"].ConnectionString;
con = new SqlConnection(s);
con.Open();
cmd = new SqlCommand("Select Fname from New_Tech", con);
dr = cmd.ExecuteReader();
while (dr.Read())
{
ddlAllow.Items.Add(dr[0].ToString());
}
dr.Close();
con.Close();
}
protected void btnAllo_Click(object sender, EventArgs e)
{
string var_comp_no;
string var_Tech_name;
var_comp_no = ddlComplaint.SelectedValue;
var_Tech_name=ddlAllow.SelectedValue;
SqlCommand cmd_insert = new SqlCommand();
SqlConnection con = new SqlConnection("SERVER=KSHITIJA-PC; Initial Catalog=CRM;Integrated Security=True");
cmd_insert.Connection = con;
cmd_insert.CommandType = CommandType.StoredProcedure;
cmd_insert.CommandText = "Allocate_Call";
cmd_insert.Parameters.Add(new SqlParameter("@comp_no", SqlDbType.Int));
cmd_insert.Parameters["@comp_no"].Value = var_comp_no; ;
cmd_insert.Parameters.Add(new SqlParameter("@Tech_name", SqlDbType.VarChar, 50));
cmd_insert.Parameters["@Tech_name"].Value = var_Tech_name;
try
{
con.Open();
int i = cmd_insert.ExecuteNonQuery(); ;
//int a = cmd1.ExecuteNonQuery();
if (i == 1)
{
ddlComplaint.SelectedItem.Text = "";
EO.Web.MsgBoxButton mb = new EO.Web.MsgBoxButton("OK");
MsgBox1.Show("Message: ", "Call Assigned to Technician", null, mb);
}
}
catch (Exception ex)
{
EO.Web.MsgBoxButton mb = new EO.Web.MsgBoxButton("OK");
MsgBox1.Show("Error: ", ex.Message, null, mb);
}
finally
{
con.Close();
}
}
& Code of stored procedure
CREATE PROCEDURE Alloc
Member 9693583
4-Jan-13 5:05am
View
is this case working when complaint_no & Tech_name selected from dropdownlist (Which is also comes from database only)
Member 9693583
4-Jan-13 4:59am
View
hi, See my front end coding.... actually i want to select complaint no. from 1 dropdownlist(which comes from databse only) & Tech_name from another dropdownlist(which comes from database only) and insert the particular record of selected complaint no. in along with Tech_name in another table on button click
Code for ur reference
SqlConnection con;
SqlCommand cmd;
SqlDataReader dr;
private string s;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
ddlComplaint.Items.Insert(0, new ListItem("---Select---", "---Select---"));
FillDropDownList();
ddlAllow.Items.Insert(0, new ListItem("---Select---", "---Select---"));
FillTechnicianDropDownList();
}
}
// Fill Dropdownlist
public void FillDropDownList()
{
s = WebConfigurationManager.ConnectionStrings["Callregister_connectionstring"].ConnectionString;
con = new SqlConnection(s);
con.Open();
cmd = new SqlCommand("Select Complaint_no from Call_Reg where Status='Open'" , con);
dr = cmd.ExecuteReader();
while (dr.Read())
{
ddlComplaint.Items.Add(dr[0].ToString());
}
dr.Close();
con.Close();
}
// Show data in GridView
protected void btnSearch_Click(object sender, EventArgs e)
{
s = WebConfigurationManager.ConnectionStrings["Callregister_connectionstring"].ConnectionString;
con = new SqlConnection(s);
con.Open();
cmd = new SqlCommand("Select * from Call_Reg where Complaint_no='" + ddlComplaint.SelectedItem.ToString() + "'", con);
dr = cmd.ExecuteReader();
GridView2.DataSource = dr;
GridView2.DataBind();
dr.Close();
con.Close();
}
// Fill Technician
public void FillTechnicianDropDownList()
{
s = WebConfigurationManager.ConnectionStrings["Callregister_connectionstring"].ConnectionString;
con = new SqlConnection(s);
con.Open();
cmd = new SqlCommand("Select Fname from New_Tech", con);
dr = cmd.ExecuteReader();
while (dr.Read())
{
ddlAllow.Items.Add(dr[0].ToString());
}
dr.Close();
con.Close();
}
protected void btnAllo_Click(object sender, EventArgs e)
{
string var_comp_no;
string var_Tech_name;
var_comp_no = ddlComplaint.SelectedValue;
var_Tech_name=ddlAllow.SelectedValue;
SqlCommand cmd_insert = new SqlCommand();
SqlConnection con = new SqlConnection("SERVER=KSHITIJA-PC; Initial Catalog=CRM;Integrated Security=True");
cmd_insert.Connection = con;
cmd_insert.CommandType = CommandType.StoredProcedure;
cmd_insert.CommandText = "Allocate_Call";
cmd_insert.Parameters.Add(new SqlParameter("@comp_no", SqlDbType.Int));
cmd_insert.Parameters["@comp_no"].Value = var_comp_no; ;
cmd_insert.Parameters.Add(new SqlParameter("@Tech_name", SqlDbType.VarChar, 50));
cmd_insert.Parameters["@Tech_name"].Value = var_Tech_name;
try
{
con.Open();
int i = cmd_insert.ExecuteNonQuery(); ;
//int a = cmd1.ExecuteNonQuery();
if (i == 1)
{
ddlComplaint.SelectedItem.Text = "";
EO.Web.MsgBoxButton mb = new EO.Web.MsgBoxButton("OK");
MsgBox1.Show("Message: ", "Call Assigned to Technician", null, mb);
}
}
catch (Exception ex)
{
EO.Web.MsgBoxButton mb = new EO.Web.MsgBoxButton("OK");
MsgBox1.Show("Error: ", ex.Message, null, mb);
}
finally
{
con.Close();
}
}
& Code of stored procedure
CREATE PROCEDURE Allocate_call
AS
BEGIN
Declare @comp_no as numeric(10)
Declare @Tech_name as varchar(50)
select @comp_no = Complaint_no from Call_Reg
Member 9693583
4-Jan-13 4:47am
View
Thanks for ur suggestion. its working when we parse the stored procedure but its not working while executing query
Member 9693583
4-Jan-13 4:45am
View
Hi,
But I want Tech_name & Comp_no should retrieve from database... pls suggest.. I want data of dropdownlist(which is retrived from database) to be insered in another table
Kindly guide
Member 9693583
3-Jan-13 17:34pm
View
Thanks... Will Try it..
Member 9693583
3-Jan-13 17:23pm
View
Thanks for advice... but this is not the case actually i dint use store proc. yet. thats y i m neglecting or something... i m student and this is my collage project & have to submit by tommarow so trying wht i know but there is also problem bad luck.. :(
Member 9693583
3-Jan-13 16:55pm
View
Hi, Thanks for reply...
Actually I want run this type of query
SqlCommand cmd = new SqlCommand(" insert into Call_Allocation values((select '" + ddlAllow.SelectedItem.ToString() + "' where Complaint_no= '" + ddlComplaint.SelectedItem.ToString() + "' ))", con);
Error occured : Subqueries are not allowed in this context. Only scalar expressions are allowed
& one more thing i dont have Tech_name field in Call_Reg table but it is there in Tech_Allocation table & i want to be inserted in Call_updation table
Member 9693583
3-Jan-13 16:15pm
View
There dont have any error but data has to be inserted on button click. there is something wrong in this query but i dont understand what it is?
insert into Call_Allocation values('select a.Fname from New_Tech a join Call_reg b on a.Fname=b.Complaint_no '", con);
Or i am using join instead of subquery... is that a problem
pls help me
thanks n regards,
kshitija
Member 9693583
3-Jan-13 15:47pm
View
It is not working....
I m trying below code
protected void btnAllo_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection("SERVER=KSHITIJA-PC; Initial Catalog=CRM;Integrated Security=True");
//SqlCommand cmd = new SqlCommand("Update Call_reg set status='Assigned' Where Complaint_no= '" + ddlComplaint.SelectedItem.ToString() + "'", con);
SqlCommand cmd = new SqlCommand(" insert into Call_Allocation values('select a.Fname from New_Tech a join Call_reg b on a.Fname=b.Complaint_no '", con);
try
{
con.Open();
int i = cmd.ExecuteNonQuery();
//int a = cmd1.ExecuteNonQuery();
if (i == 1)
{
ddlComplaint.SelectedItem.Text = "";
EO.Web.MsgBoxButton mb = new EO.Web.MsgBoxButton("OK");
MsgBox1.Show("Message: ", "Call Assigned to Technician", null, mb);
}
}
catch (Exception ex)
{
EO.Web.MsgBoxButton mb = new EO.Web.MsgBoxButton("OK");
MsgBox1.Show("Error: ", ex.Message, null, mb);
}
con.Close();
}
Member 9693583
3-Jan-13 14:10pm
View
Can u pls write detail query... i m very much confusing....
Thanks & regards,
Kshitija
Member 9693583
3-Jan-13 10:53am
View
Yuuuuuuhuuuuu..... Done... Thanks Zafan... U dont understand wht u have done.... thaku thanku so much...
Member 9693583
3-Jan-13 9:56am
View
hi prasad, tried below code & call it on button click.... exception error
"Invalid operation exception was unhandled by user code" pls help..
private void ddlstatebind()
{
SqlCommand cmd = new SqlCommand("Select state from Call_Reg ", con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
ddlstat.DataSource = ds;
ddlstat.DataValueField = "state";
ddlstat.DataBind();
}
Member 9693583
3-Jan-13 9:41am
View
Yes Zafan, I m passing complaint no. & filling the data from query on button click.... Ohhhoo.... this code is not working on button click.... pls help me...
Member 9693583
3-Jan-13 9:30am
View
hi vaibhav,Thanks 4 reply... I tried that code but its not working i want the code on button click event
Member 9693583
3-Jan-13 7:32am
View
Hi, Vaibhavmane, we have to insert list one by one or only one line code read all data for dropdownlist from database??? pls help.... thanks & regards,
kshitija
Member 9693583
3-Jan-13 7:26am
View
I tried below code but there is no change in dropdownlist.... Dropdownlist is not showing the item.
SqlCommand cmd = default(SqlCommand);
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["Callregister_connectionstring"].ConnectionString);
con.Open();
cmd = new SqlCommand("Select * from Call_Reg where Complaint_no='" + ddlupCompl.SelectedItem.ToString() + "'", con);
SqlDataReader reader = cmd.ExecuteReader();
int i=0;
while (reader.Read())
{
txtFname.Text = Convert.ToString(reader["Cust_FName"]);
txtLname.Text = Convert.ToString(reader["Cust_LName"]);
txtPh.Text = Convert.ToString(reader["ph_no"]);
txtMob.Text = Convert.ToString(reader["mob_no"]);
txtemail.Text = Convert.ToString(reader["email"]);
txtadd.Text = Convert.ToString(reader["address"]);
txtcity.Text = Convert.ToString(reader["city"]);
txtdist.Text = Convert.ToString(reader["dist"]);
ddlstat.Items.Add(new ListItem(Convert.ToString(reader["state"]),i.ToString()));
i++;
}
con.Close();
}
Member 9693583
3-Jan-13 6:29am
View
Thanks HashamAhmad, Its working fine.. :)
Member 9693583
3-Jan-13 3:51am
View
Hi,
Thanks for ur reply..
I m trying below mentioned code... But really don't understand where i m wrong... can u please help me out... i will be very glad...
thanks
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.Web.Configuration;
public partial class Callupdation : System.Web.UI.Page
{
private void loadData()
{
SqlCommand cmd = default(SqlCommand);
SqlConnection con = default(SqlConnection);
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["Callregister_connectionstring"].ConnectionString);
con = new SqlConnection("SERVER=KSHITIJA-PC; Initial Catalog=CRM;Integrated Security=True" "Callregister_connectionstring");
con.Open();
cmd = new SqlCommand("Select * from Call_Reg ", con);
SqlDataReader reader = cmd.ExecuteReader();
txtFname.Text = Convert.ToString(reader["Cust_FName"]);
con.Close();
}
Show More