16,016,501 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 11308948 (Top 12 by date)
Member 11308948
18-Dec-14 23:36pm
View
any solution
Member 11308948
18-Dec-14 2:26am
View
is it like this sir?
public string generateSNo()
{
String str = "SELECT Max(std_ID) From tblStudent";
string std_ID = null;
SqlCommand con = new SqlCommand(str, cn);
try
{
cn.Open();
object result = con.ExecuteScalar();
if (result == DBNull.Value)
{
std_ID = "S001";
}
else
{
std_ID = (string)result;
string[] splitCode = std_ID.Split('S');
int id = 0;
int.TryParse(splitCode[0], out id);
id++;
std_ID = string.Format("S{0:D3}", id); //To have values like: S001, S002, ..., S099, ..., S999!
}
}
finally
{
cn.Close();
}
return std_ID;
}
Member 11308948
18-Dec-14 2:07am
View
sir , now its run and the id is generated but
once i save it shows the connection not closed when i already con.close()
Member 11308948
18-Dec-14 1:44am
View
thank your sir.problem solved
Member 11308948
18-Dec-14 1:19am
View
I did this for generate feedback no it's working perfectly
public string generateFNo()
{
String str = "SELECT Max(fdk_No) From tblFeedback";
string fNo = null;
SqlCommand con = new SqlCommand(str, cn);
cn.Open();
if (con.ExecuteScalar().Equals(DBNull.Value))
{
fNo = "F01";
}
else
{
fNo = (string)con.ExecuteScalar();
//Display the new fdkno (by get the last fdkno from db)+1
string[] splitCode = Strings.Split(fNo, "F", 2);
fNo = "F0" + ((Convert.ToInt32(splitCode[1])) + 1).ToString();
}
cn.Close();
return fNo;
}
Member 11308948
18-Dec-14 1:18am
View
:'(
now this error Object reference not set to an instance of an object.
Member 11308948
18-Dec-14 1:13am
View
im getting the error
Member 11308948
18-Dec-14 1:00am
View
Input string was not in a correct format.
Member 11308948
18-Dec-14 0:51am
View
is there any solution because i applied the same method for generate feedback no its work perfectly but to generate student no its showing error
Member 11308948
14-Dec-14 0:17am
View
Sir,I had updated my question. Im still facing the same issue Implicit conversion from data type varchar to varbinary(max) is not allowed. Use the CONVERT function to run this query.
Member 11308948
14-Dec-14 0:10am
View
Deleted
Sir,I had updated my question. Im still facing the same issue Implicit conversion from data type varchar to varbinary(max) is not allowed. Use the CONVERT function to run this query.
Member 11308948
14-Dec-14 0:00am
View
after adding parametererized statement. now im facing this issue
No mapping exists from object type System.Web.UI.WebControls.CheckBoxList to a known managed provider native type.
Show More