I have two problems
1. I have develop and Installed a project on my computer. that was work on my PC so many days. but now prject not work properly.
It give me error message that SQl connection not avaliable.
Is their is any way to overcome this problem.
Can we store the path of connectionstring in one method and then call that where i need in entire project.
2. crystal report:
I want to dispaly crystal report on combobox index chage event
I have ten tables.
I have use parameterized queary for that but when designing the crystal report. I have to set dataset and spacify the table and drag and drop the feild of that table. Report show the data of that table but i want to dispaly data on user selection table name.
string val = comboBox1.Text.ToString(); string contr = "Data Source=WELL\\SQLEXPRESS;Initial Catalog=hire;Integrated Security=True"; SqlConnection cn = new SqlConnection(); cn.ConnectionString = contr; cn.Open(); string str = "select concd,deb,crd,vec from " + comboBox1.Text + " where hrnm=@val"; SqlCommand cmd = new SqlCommand(str, cn); cmd.CommandType = CommandType.Text; SqlParameter sql; sql = cmd.Parameters.Add("@val", SqlDbType.VarChar, 15); sql.Value = val; SqlDataAdapter da = new SqlDataAdapter(); da.SelectCommand = cmd; DataSet ds = new DataSet(); da.Fill(ds, comboBox1.Text); CrystalReport13 cr = new CrystalReport13(); cr.SetDataSource(ds); crystalReportViewer1.ReportSource = cr; cn.Close();
what changs I have to perform in my designing or coding
thanks in advance.....