Click here to Skip to main content
15,898,134 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
frendz m getting this error while selecting the data "invalid object name Taluka" that my code

C#
private void button1_Click(object sender, EventArgs e)
        {       SqlConnection cn = new SqlConnection("Data Source=AHASSAN-PC\\SQLSERVER2012;Initial Catalog=Sindh2_LARMIS_UAT_March;Integrated Security=True");
  cn.Open();
    
  SqlCommand cmd = new SqlCommand();
   cmd.Connection = cn;
   cmd.CommandText = "Select zilla_id from Taluka where taluka_id='18ae1965-9cab-49c2-bd34-1ab7d3cd55e2'";
     SqlDataAdapter sqlDataAdap = new SqlDataAdapter(cmd);
     DataSet ds = new DataSet();
     sqlDataAdap.Fill(ds, "ss");
     dataGridView1.DataSource = ds.Tables["ss"];

     dataGridView1.Rows[1].Visible = false;
     //dataGridView1.Columns[3].Visible = false;
   cn.Close();

kindly help me
Posted
Updated 18-Mar-15 20:36pm
v3
Comments
ClimerChinna 19-Mar-15 1:44am    
is there Taluka table in your database
Ammyt20 19-Mar-15 1:54am    
yes
[no name] 19-Mar-15 2:08am    
Restart your database then check.
Ammyt20 19-Mar-15 2:13am    
done still giving same error.
Saral S Stalin 19-Mar-15 4:35am    
What is the schema name of the table Talukha? Is it dbo.Talukha or something else? Please specify schema name in the query and try again

check your table name whether spelling is wrong
 
Share this answer
 
Comments
Ammyt20 19-Mar-15 1:54am    
itz correct sme name of the table in sql
King Fisher 19-Mar-15 2:07am    
Check your DB of "Sindh2_LARMIS_UAT_March" contains Taluka table.
Ammyt20 19-Mar-15 2:23am    
itz have that table its name showing Taluka (territory) but when i ryt click check its properties its showing Taluka table name
King Fisher 19-Mar-15 2:30am    
The Error says the table not available in your database.
Check this..
1) Are you using correct databse in ur connection string or check Sindh2_LARMIS_UAT_March database contain the table Taluka.
2) Check the Spelling of your table name Taluka in ur code and ur database.
 
Share this answer
 
v2

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