2, the button code
Public da As SqlDataAdapter
Public ds As the DataSet
Public dt As DataTable
Public strConnStr As String=ConfigurationManager. AppSettings (" SqlserverConnString ")
Public conn As SqlClient. SqlConnection=New SqlClient. SqlConnection (strConnStr)
Dim sqltxt1 As String
Sqltxt1="select * from hz1 where demand quantity & lt;> The arrival of the goods quantity and project USES & lt;> 'water making raw materials and DatePart (yyyy, [date])=' "& amp; Y & amp; "' order by date
"Da=New SqlDataAdapter (sqltxt1, conn.)
Dt=New DataTable
Da. The Fill (dt)
DataGridView1. The DataSource=dt
Test environment problem, exe the ConnectionString property has not been initialized, after the great god, please give directions!!!!!!!!!!
CodePudding user response:
Public strConnStr As String=ConfigurationManager. AppSettings (" SqlserverConnString "). The value (plus the)CodePudding user response: