اگر در هنگام نصب sql server خطای
System.Configuration.ConfigurationErrorsException: An error occurred creating the configuration section handler for userSettings/Microsoft.SqlServer.Configuration.LandingPage.Properties.Settings: Could not load file or assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the file specified. (C:\Documents and Settings\aslani\Local Settings\Application Data\Microsoft_Corporation\LandingPage.exe_StrongName_ryspccglaxmt4nhllj5z3thycltsvyyx\10.0.0.0\user.config line 5) ---> System.IO.FileNotFoundException: Could not load file or assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the file specified.
ظاهر شد و ادامه نصب با مشکل مواجه شده به مسیر زیر رفته و فایل user.config یا کل فلدر Microsoft_Corporation را پاک کنید
[USER_NAME]\ApplicationData\Local\Microsoft_Corporation\LandingPage.exe_StrongName_ryspccglaxmt4nhllj5z3thycltsvyyx\10.0.0.0 TO USER.CONFIG.BAK
Form2 frm = new Form2(textBox1.Text); frm.Show();
حالا به فرم دوم روفته و یک Label در ان قرار دهید و سپس توی کلاس فرم دوم دستور زیر را وارد کنید .
public Form2(string strTextBox)
{
InitializeComponent();
label1.Text = strTextBox;
}
string ConnectionStr = "Data Source=(local);Initial Catalog=DataBaseName;Integrated Security=True";
SqlConnection Conn = new SqlConnection(ConnectionStr);
string CommandText = "select * from TableName where sh="+txtPerCode.Text;
SqlCommand sqlComm = new SqlCommand(CommandText, Conn);
SqlDataReader dr = sqlComm.ExecuteReader();
if (dr.HasRows)
{
DataTable dt = new DataTable();
dt.Load(dr);
dtgSavabeghList.DataSource = dt;
}