Feng,
I was curious about this, so I created a program to create a database and a
table with 200 columns.
To that I have inserted a row using the dataadapter.
If you want to try it, see the code bellow. It needs a datagrid on a form
and of course an SQLServer and ou need to change the name "TheServerName" in
the name of that
\\\\
Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Dim Conn As New
SqlConnection("Server=TheServerName;DataBase=;Integrated Security=SSPI")
Try
Conn.Open()
Try
Dim strSQL As String = "CREATE DATABASE THISCRAZYTEST"
Dim cmd As New SqlCommand(strSQL, Conn)
cmd.ExecuteNonQuery()
cmd.CommandText = _
"USE THISCRAZYTEST" & vbCrLf & _
"CREATE TABLE CrazyTest ( "
For i As Integer = 0 To 199
cmd.CommandText += "V" & i.ToString & " int, "
Next
cmd.CommandText += " CONSTRAINT [pk_V0] PRIMARY KEY
CLUSTERED(V0))"
cmd.ExecuteNonQuery()
Dim ds As New DataSet
Dim da As New SqlDataAdapter("Select * from crazyTest",
Conn)
da.Fill(ds)
Dim dr As DataRow = ds.Tables(0).NewRow
For i As Integer = 0 To 199
dr(i) = i
Next
ds.Tables(0).Rows.Add(dr)
da.InsertCommand = New SqlCommand
da.InsertCommand.CommandText = "INSERT INTO CrazyTest( "
For i As Integer = 0 To 198
da.InsertCommand.CommandText += "V" & I.ToString & ","
Next
da.InsertCommand.CommandText += " V199 ) VALUES ("
For i As Integer = 0 To 198
da.InsertCommand.CommandText += "@V" & I.ToString & ","
Next
da.InsertCommand.CommandText += "@V199 ) ; Select * FROM
CrazyTest Where V0 = @V0 "
da.InsertCommand.Connection = Conn
For i As Integer = 0 To 199
da.InsertCommand.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@V" & i.tostring, _
System.Data.SqlDbType.Int, 4, "V" & i.tostring))
Next
da.Update(ds)
da.SelectCommand.CommandText = "Select V195, V199 from
CrazyTest"
ds = new dataset
da.Fill(ds)
datagrid1.datasource = ds.Tables(0)
Catch ex As SqlException
MessageBox.Show(Ex.ToString)
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
Catch ex As Exception
MessageBox.Show(ex.ToString)
Finally
Conn.Close()
End Try
End Sub
///
I hope this helps,
Cor