Click here to Skip to main content
15,889,442 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
[WebMethod]
public static maj_hd[] bind_repter(String maj_hd)
{
     List<maj_hd> list = new List<maj_hd>();
     DataTable dt = new DataTable(); 
     using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["constringBA"].ConnectionString))
     {
          SqlCommand cmd = new SqlCommand("sql query", con);
          using (cmd) 
          {
              con.Open();
              SqlDataAdapter da = new SqlDataAdapter(cmd);
              da.Fill(dt);
          }
     }
     return list.ToArray();
}
Posted
v2
Comments
Can you tell us what is the error you are getting ?
[no name] 12-Dec-12 2:21am    
I think there should be null values in your adapter. Tag the error message for reference plz.

1 solution

Hi,

Please check your code.
you have not assigned your datasource (DataTable) to your List and not bind it.
may be that's you are getting error in retrieving of data.

mark if this is you answer.

thanks,
kk
 
Share this answer
 
Comments
Amit Jamwal 12-Dec-12 3:26am    
thnx for ur reply
i already tried that solution.
that was my mistake and i did it as u said.
but still same problem
amit jamwal

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900