473,394 Members | 1,759 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

class file in c#

sir iam new to c# .... i create the the class file in asp.net
.............................My Code is below-----------------------------------------------
using System.Data.SqlClient;
using System.Data;
using System.Collections;
using System;


namespace student_project_in_c_sharp.student_details
{
/// <summary>
/// Summary description for student_details.
/// </summary>

public class student_details
{
string Rollno_class;
string name_class;
string age_class;
string section_class;
string dob_class;
string sex_class;
string class_class;
string father_class;

public student_details()
{
//
// TODO: Add constructor logic here
//
}

#region propetites



public string Rollno
{
get{return Rollno_class;}
set{Rollno_class=value;}
}

public string name
{
get { return name_class;}
set{name_class=value;}
}
public string age
{
get { return age_class;}
set{age_class=value;}

}
public string dob
{
get { return dob_class;}
set {dob_class=value;}
}
public string section
{
get { return section_class;}
set { section_class=value;}
}
public string class1
{
get { return class_class;}
set { class_class=value;}
}
public string fathername
{
get{return father_class;}
set{father_class=value;}
}
public string sex
{
get { return sex_class;}
set { sex_class=value;}
}


# endregion



#region databaseconncetion

public bool save()
{
try
{
SqlConnection con=new SqlConnection("server=192.168.111.250;uid=sa;pwd=; database=master");
con.Open();
SqlCommand com;
com.CommandType =CommandType.StoredProcedure;
com.Connection=con;
com.CommandText="student_details_insert";
com.Parameters.Add("@rollno",Rollno_class);
com.Parameters.Add("@name",name_class);
com.Parameters.Add("@age",age_class);
com.Parameters.Add("@section",section_class);
com.Parameters.Add("@dob",dob_class);
com.Parameters.Add("@fathername",father_class);
com.Parameters.Add("@class",class_class);
com.ExecuteNonQuery();
}
catch(Exception ex)
{

Console.Write(ex.Message);


}


}
}

}


#endregion
---------------------------------------------- end code -------------------------
but in here
public bool save()
near save() not all code path return a value ...... pls help me what error this one .......
Sep 26 '07 #1
1 1066
Shashi Sadasivan
1,435 Expert 1GB
Because you are not returning any value.

Return true or false depending upon your condition.

If you are unaware of return values and what they mean to methods / functions, then you need to grab a book or search the net for tutorials!

cheers
Sep 26 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Lüpher Cypher | last post by:
Ok, here's what I'm trying to do. I have a class. Inside the class I have a method that reads a text file. In the text file I have a class name and a file name where that class is defined. Now, I...
8
by: Fu Bo Xia | last post by:
the java.lang.Object.forName method takes a java class name and returns a Class object associated with that class. eg. Class myClass = Object.forName("java.lang.String"); by if i only know the...
4
by: Hal Vaughan | last post by:
I want to have a config file for my program, which means I need to know where the config file is. If I type: java myclass and it runs myclass.class, is there any way to obtain the location of...
2
by: Pierre Rouleau | last post by:
Greetings, I'm wondering why the >> operator does not use the write() method of a class derived from the built-in file class as in DerivedFile below. In the following example: - StringFile...
10
by: Not Available | last post by:
On the host server: namespace JCart.Common public class JCartConfiguration : IConfigurationSectionHandler private static String dbConnectionString; public static String ConnectionString { get...
16
by: pawel.pabich | last post by:
Hajo, I would like to have 2 my own partial classes. For example: Default.aspx.cs Default2.aspx.cs and they both will relate to Default.aspx page.
0
by: Daniel Sélen Secches | last post by:
I found a good class to do a simple FTP. Very good.... I'm posting it with the message, i hope it helps someone ============================================================== Imports...
4
by: joe | last post by:
I have the following header file generated by Java JNI's header file generator (see bottom). Obviously I will write a source file which will provide an implementation of these methods. I have...
7
by: tshad | last post by:
I have a problem with a VS 2003 project. This project was designed and works fine in VS 2003. But trying to open the project I get the following error....
4
by: alacrite | last post by:
I have a class that I want to turn its contents into csv file. I want to be able to set the value of the delimiter, the name of the file it gets saved to, the path of that file, and maybe a few...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.