出错如下:
Server Error in '/' Application.
--------------------------------------------------------------------------------Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. Compiler Error Message: CS1519: Invalid token '(' in class, struct, or interface member declarationSource Error: Line 4: string strConnection="server=localhost;uid=sa;pwd=111;database=mytest";
Line 5: SqlConnection sqlcon=new SqlConnection(strConnection);
Line 6: sqlcon.Open();
Line 7: </script>
Line 8: <style Type="Text/css">
Source File: c:\inetpub\wwwroot\lyl\test.aspx Line: 6
Server Error in '/' Application.
--------------------------------------------------------------------------------Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. Compiler Error Message: CS1519: Invalid token '(' in class, struct, or interface member declarationSource Error: Line 4: string strConnection="server=localhost;uid=sa;pwd=111;database=mytest";
Line 5: SqlConnection sqlcon=new SqlConnection(strConnection);
Line 6: sqlcon.Open();
Line 7: </script>
Line 8: <style Type="Text/css">
Source File: c:\inetpub\wwwroot\lyl\test.aspx Line: 6
改为:
string strConnection="server=local;uid=sa;pwd=111;database=mytest";
public void Page_Load()
{
string strConnection="server=localhost;uid=sa;pwd=111;database=mytest";
SqlConnection sqlcon=new SqlConnection(strConnection);
sqlcon.Open();
}
SqlConnection sqlcon=new SqlConnection(strConnection);
SqlConnection sqlcon=new SqlConnection(strConnection);
顶!!!!!!!!!!!!!!!!!!!!!!!
SqlConnection sqlcon=new SqlConnection(strConnection);
sqlcon.Open();
http://www.connectionstrings.com/
http://community.csdn.net/Expert/TopicView3.asp?id=3705163