15,895,462 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 ravivangala (Top 7 by date)
ravivangala
12-Feb-13 8:42am
View
i want this answer for db2 environment not for sql please help... top is not working in db2
ravivangala
13-Jan-12 7:50am
View
i think i will return as
M001
N002
but the code sholud be like
M001
N001
ravivangala
13-Jan-12 7:47am
View
ado.net,connected architecture
jst check out the code bellow
ravivangala
13-Jan-12 7:44am
View
/*presentation layer */
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace compliants
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void btnRegister_Click(object sender, EventArgs e)
{
compliants objcompliants = new compliants();
objcompliants.compliantID = txtCompliantID.Text;
objcompliants.compliantDate = dtpCompliantDate.Value;
objcompliants.IpAddress = txtIpAddress.Text;
objcompliants.ProblemDescription = txtDescription.Text;
objcompliants.Responsibility = cmbResponsibility.Text;
compliants obj = new compliants();
obj.Savecompliants(objcompliants);
string compliantid = obj.Insertcompliants();
txtCompliantID.Text = compliantid;
MessageBox.Show("success");
}
/* public void cmbResponsibility_SelectedIndexChanged(object sender, EventArgs e)
{
compliants objcompliants = new compliants();
compliants obj = new compliants();
if (cmbResponsibility.Text == "Select UserType")
{
MessageBox.Show("Please select user !");
}
else if (cmbResponsibility.SelectedIndex == 0)
{
txtCompliantID.Text= "M";
}
else if (cmbResponsibility.SelectedIndex == 1)
{
txtCompliantID.Text ="N";
}
else
{
txtCompliantID.Text ="O";
}
obj.GenerateID(txtCompliantID.Text);
}*/
}
}
ravivangala
13-Jan-12 7:42am
View
/*this is class file */
using System;
using System.Collections.Generic;
using System.Linq;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Text;
namespace compliants
{
#region class compliants
class compliants
{
#region variables
SqlConnection connection;
SqlCommand command;
SqlDataReader dr;
#endregion variables
#region properties
public int ID
{ get;
set;
}
public string compliantID
{
get;
set;
}
public DateTime compliantDate
{
get;
set;
}
public string IpAddress
{
get;
set;
}
public string ProblemDescription
{
get;
set;
}
public string Responsibility
{
get;
set;
}
#endregion properties
#region methods
public void Savecompliants(compliants objcompliants)
{
compliantID = objcompliants.compliantID;
compliantDate = objcompliants.compliantDate;
IpAddress = objcompliants.IpAddress;
ProblemDescription = objcompliants.ProblemDescription;
Responsibility = objcompliants.Responsibility;
}
/* public string GenerateID(String compliantID)
{
connection = connectionHelper.GetConnection();
SqlCommand cmd = new SqlCommand("select top 1 CompliantID from Compliants where CompliantID like '" + compliantID + "%' order by ID DESC",connection);
connection.Open();
string c = compliantID;
object b = command.ExecuteScalar();
string num = "";
if (b == null)
{
num = c + "001";
}
else
{
num = b.ToString();
int n=Convert.ToInt32(num.Substring(1,num.Length-1));
n++;
if (n >= 1 && n <= 9)
num = c+"00"+n;
if (n >= 10 && n <= 99)
num = c+"0"+n;
if (n >= 100 && n <= 999)
num = c+n;
}
connection.Close();
return compliantID;
}*/
public string Insertcompliants()
{
connection = connectionHelper.GetConnection();
command = new SqlCommand("proccomplaint", connection);
connection.Open();
command.CommandType = CommandType.StoredProcedure;
command.Parameters.AddWithValue("@compliantID",compliantID);
command.Parameters.AddWithValue("@CompliantDate",compliantDate);
command.Parameters.AddWithValue("@IpAddress",IpAddress);
command.Parameters.AddWithValue("@ProblemDescription",ProblemDescription);
command.Parameters.AddWithValue("@Responsibility",Responsibility);
command.ExecuteNonQuery();
string compliantid =Convert.ToString(command.Parameters["@CompliantID"].Value);
return compliantid;
}
#endregion methods
}
#endregion class compliants
}
ravivangala
13-Jan-12 7:37am
View
i tried a lot but couldn't find solution...
ravivangala
10-Jan-12 23:57pm
View
yes i want to insert complaintdate and IpAdress,ProblemDesc,Resp
then system need to generate complaintid automatically if i give responce is management like that M001 OR IF I GIVE responce is networkperson it should generate N001 AND IF I GIVE OTHERS TO RESPONCE FIELD IT SHOULD GENERATE 0001 AS COMPLAINT ID....PLEASE HELP ME REGARDING THIS....
Show More