>Dim oConnStr As String = "data source=localhost;initial catalog=Northwind;integrated security=SSPI;persist security info=False;packet size=4096" > >' Make connection to database >Dim oConn As New SqlConnection() >oConn.ConnectionString = oConnStr >oConn.Open() > >' Create a Command object with select statement >Dim strSelect As [String] = "SELECT FirstName,LastName,Title FROM EMPLOYEES" >Dim oSelectCommand As New SqlCommand(strSelect, oConn) > >' Create a Command object with insert statement >Dim strInsert As [String] = "INSERT INTO EMPLOYEES(FirstName,LastName,Title) values (@FirstName,@LastName,@Title)" > >Dim oInsertCommand As New SqlCommand(strInsert, oConn) >oInsertCommand.Parameters.Add(New System.Data.SqlClient.SqlParameter("@FirstName", System.Data.SqlDbType.NVarChar, 10, "FirstName")) >oInsertCommand.Parameters.Add(New System.Data.SqlClient.SqlParameter("@LastName", System.Data.SqlDbType.NVarChar, 20, "LastName")) >oInsertCommand.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Title", System.Data.SqlDbType.NVarChar, 30, "Title")) > >' Create a DataAdapter >Dim da As New SqlDataAdapter() >da.SelectCommand = oSelectCommand >da.InsertCommand = oInsertCommand > >' Create a DataSet >Dim ds As New DataSet() > >' Fill the DataSet with table information >da.Fill(ds, "Employees") > >Dim dr As DataRow = ds.Tables(0).NewRow() >dr("FirstName") = "NetFN" >dr("LastName") = "NetLN" >dr("Title") = Convert.DBNull >ds.Tables(0).Rows.Add(dr) > >da.Update(ds.Tables(0)) > >oConn.Close() >>
>>>insert into TABLENAME (FIELD1, FIELD2) values ('TEXT', NULL)
>>>
>>>>>>rowCustomer("ContactName") = Convert.DBNull >>>>>>