John Gates, CISSP, CDPSE
asked on
Having Data Fill Problem
In a VB.NET project I have set up a SQL adapter and can successfully Preview the data but when I try to do it in my form with:
SqlDataAdapter1.Fill(DataS et11)
It immediately returns a system error. Why would this happen?
SqlDataAdapter1.Fill(DataS
It immediately returns a system error. Why would this happen?
ASKER
it's that simple just this fill command is in a button event. The error returned is "System Error" I can preview data no problem from the adapter...
SqlDataAdapter1.Fill(DataS
As emoreau mentions, you need to give us a bit more information, and perhaps your code.
Without that, we can only guess what going wrong.
Is the complete error message "System Error" or is there further information there?
I am guessing thhat you are using the Data Access components from the toolbox, given that you say you can 'preview' the data ok.
Is it that those controols have already called the .Fill method, which then causes the error when you call it again?
Please post your code, including the Designere-generated code pertaining to the data access.
Best Regards,
David
Without that, we can only guess what going wrong.
Is the complete error message "System Error" or is there further information there?
I am guessing thhat you are using the Data Access components from the toolbox, given that you say you can 'preview' the data ok.
Is it that those controols have already called the .Fill method, which then causes the error when you call it again?
Please post your code, including the Designere-generated code pertaining to the data access.
Best Regards,
David
ASKER
Remember you asked for it LOL:
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.ICon tainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents SqlConnection1 As System.Data.SqlClient.SqlC onnection
Friend WithEvents SqlDataAdapter1 As System.Data.SqlClient.SqlD ataAdapter
Friend WithEvents Button1 As System.Windows.Forms.Butto n
Friend WithEvents SqlSelectCommand1 As System.Data.SqlClient.SqlC ommand
Friend WithEvents SqlInsertCommand1 As System.Data.SqlClient.SqlC ommand
Friend WithEvents DataSet11 As ORStudentCreate.DataSet1
<System.Diagnostics.Debugg erStepThro ugh()> Private Sub InitializeComponent()
Me.SqlConnection1 = New System.Data.SqlClient.SqlC onnection
Me.SqlDataAdapter1 = New System.Data.SqlClient.SqlD ataAdapter
Me.Button1 = New System.Windows.Forms.Butto n
Me.SqlSelectCommand1 = New System.Data.SqlClient.SqlC ommand
Me.SqlInsertCommand1 = New System.Data.SqlClient.SqlC ommand
Me.DataSet11 = New ORStudentCreate.DataSet1
CType(Me.DataSet11, System.ComponentModel.ISup portInitia lize).Begi nInit()
Me.SuspendLayout()
'
'SqlConnection1
'
Me.SqlConnection1.Connecti onString = "workstation id=ROCKET;packet size=4096;user id=sa;data source=""3dserv\SQL20053D" ";" & _
"persist security info=False;initial catalog=DI"
'
'SqlDataAdapter1
'
Me.SqlDataAdapter1.InsertC ommand = Me.SqlInsertCommand1
Me.SqlDataAdapter1.SelectC ommand = Me.SqlSelectCommand1
Me.SqlDataAdapter1.TableMa ppings.Add Range(New System.Data.Common.DataTab leMapping( ) {New System.Data.Common.DataTab leMapping( "Table", "ADST", New System.Data.Common.DataCol umnMapping () {New System.Data.Common.DataCol umnMapping ("STATUS", "STATUS"), New System.Data.Common.DataCol umnMapping ("SCHOOLNU M", "SCHOOLNUM"), New System.Data.Common.DataCol umnMapping ("LASTNAME ", "LASTNAME"), New System.Data.Common.DataCol umnMapping ("FIRSTNAM E", "FIRSTNAME"), New System.Data.Common.DataCol umnMapping ("MIDDLENA ME", "MIDDLENAME"), New System.Data.Common.DataCol umnMapping ("PERMNUM" , "PERMNUM"), New System.Data.Common.DataCol umnMapping ("BIRTHDAT E", "BIRTHDATE"), New System.Data.Common.DataCol umnMapping ("PRNTGUAR D", "PRNTGUARD"), New System.Data.Common.DataCol umnMapping ("MAILADDR ", "MAILADDR"), New System.Data.Common.DataCol umnMapping ("CITY", "CITY"), New System.Data.Common.DataCol umnMapping ("ZIPCODE" , "ZIPCODE"), New System.Data.Common.DataCol umnMapping ("STATE", "STATE"), New System.Data.Common.DataCol umnMapping ("TELEPHON E", "TELEPHONE"), New System.Data.Common.DataCol umnMapping ("BIRTHPLA CE", "BIRTHPLACE"), New System.Data.Common.DataCol umnMapping ("HOMELNG" , "HOMELNG"), New System.Data.Common.DataCol umnMapping ("PRIMARYL NG", "PRIMARYLNG"), New System.Data.Common.DataCol umnMapping ("DSTLINK" , "DSTLINK")})})
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(256, 400)
Me.Button1.Name = "Button1"
Me.Button1.TabIndex = 1
Me.Button1.Text = "Button1"
'
'SqlSelectCommand1
'
Me.SqlSelectCommand1.Comma ndText = "SELECT STATUS, SCHOOLNUM, LASTNAME, FIRSTNAME, MIDDLENAME, PERMNUM, BIRTHDATE, PR" & _
"NTGUARD, MAILADDR, CITY, ZIPCODE, STATE, TELEPHONE, BIRTHPLACE, HOMELNG, PRIMARY" & _
"LNG, DSTLINK FROM SASI.ADST WHERE (STATUS = '')"
Me.SqlSelectCommand1.Conne ction = Me.SqlConnection1
'
'SqlInsertCommand1
'
Me.SqlInsertCommand1.Comma ndText = "INSERT INTO SASI.ADST(STATUS, SCHOOLNUM, LASTNAME, FIRSTNAME, MIDDLENAME, PERMNUM" & _
", BIRTHDATE, PRNTGUARD, MAILADDR, CITY, ZIPCODE, STATE, TELEPHONE, BIRTHPLACE, H" & _
"OMELNG, PRIMARYLNG, DSTLINK) VALUES (@STATUS, @SCHOOLNUM, @LASTNAME, @FIRSTNAME," & _
" @MIDDLENAME, @PERMNUM, @BIRTHDATE, @PRNTGUARD, @MAILADDR, @CITY, @ZIPCODE, @STA" & _
"TE, @TELEPHONE, @BIRTHPLACE, @HOMELNG, @PRIMARYLNG, @DSTLINK); SELECT STATUS, SC" & _
"HOOLNUM, LASTNAME, FIRSTNAME, MIDDLENAME, PERMNUM, BIRTHDATE, PRNTGUARD, MAILADD" & _
"R, CITY, ZIPCODE, STATE, TELEPHONE, BIRTHPLACE, HOMELNG, PRIMARYLNG, DSTLINK FRO" & _
"M SASI.ADST"
Me.SqlInsertCommand1.Conne ction = Me.SqlConnection1
Me.SqlInsertCommand1.Param eters.Add( New System.Data.SqlClient.SqlP arameter(" @STATUS", System.Data.SqlDbType.VarC har, 1, "STATUS"))
Me.SqlInsertCommand1.Param eters.Add( New System.Data.SqlClient.SqlP arameter(" @SCHOOLNUM ", System.Data.SqlDbType.VarC har, 3, "SCHOOLNUM"))
Me.SqlInsertCommand1.Param eters.Add( New System.Data.SqlClient.SqlP arameter(" @LASTNAME" , System.Data.SqlDbType.VarC har, 40, "LASTNAME"))
Me.SqlInsertCommand1.Param eters.Add( New System.Data.SqlClient.SqlP arameter(" @FIRSTNAME ", System.Data.SqlDbType.VarC har, 20, "FIRSTNAME"))
Me.SqlInsertCommand1.Param eters.Add( New System.Data.SqlClient.SqlP arameter(" @MIDDLENAM E", System.Data.SqlDbType.VarC har, 13, "MIDDLENAME"))
Me.SqlInsertCommand1.Param eters.Add( New System.Data.SqlClient.SqlP arameter(" @PERMNUM", System.Data.SqlDbType.VarC har, 12, "PERMNUM"))
Me.SqlInsertCommand1.Param eters.Add( New System.Data.SqlClient.SqlP arameter(" @BIRTHDATE ", System.Data.SqlDbType.Date Time, 8, "BIRTHDATE"))
Me.SqlInsertCommand1.Param eters.Add( New System.Data.SqlClient.SqlP arameter(" @PRNTGUARD ", System.Data.SqlDbType.VarC har, 35, "PRNTGUARD"))
Me.SqlInsertCommand1.Param eters.Add( New System.Data.SqlClient.SqlP arameter(" @MAILADDR" , System.Data.SqlDbType.VarC har, 35, "MAILADDR"))
Me.SqlInsertCommand1.Param eters.Add( New System.Data.SqlClient.SqlP arameter(" @CITY", System.Data.SqlDbType.VarC har, 24, "CITY"))
Me.SqlInsertCommand1.Param eters.Add( New System.Data.SqlClient.SqlP arameter(" @ZIPCODE", System.Data.SqlDbType.VarC har, 10, "ZIPCODE"))
Me.SqlInsertCommand1.Param eters.Add( New System.Data.SqlClient.SqlP arameter(" @STATE", System.Data.SqlDbType.VarC har, 2, "STATE"))
Me.SqlInsertCommand1.Param eters.Add( New System.Data.SqlClient.SqlP arameter(" @TELEPHONE ", System.Data.SqlDbType.Deci mal, 9, System.Data.ParameterDirec tion.Input , False, CType(15, Byte), CType(0, Byte), "TELEPHONE", System.Data.DataRowVersion .Current, Nothing))
Me.SqlInsertCommand1.Param eters.Add( New System.Data.SqlClient.SqlP arameter(" @BIRTHPLAC E", System.Data.SqlDbType.VarC har, 20, "BIRTHPLACE"))
Me.SqlInsertCommand1.Param eters.Add( New System.Data.SqlClient.SqlP arameter(" @HOMELNG", System.Data.SqlDbType.VarC har, 3, "HOMELNG"))
Me.SqlInsertCommand1.Param eters.Add( New System.Data.SqlClient.SqlP arameter(" @PRIMARYLN G", System.Data.SqlDbType.VarC har, 3, "PRIMARYLNG"))
Me.SqlInsertCommand1.Param eters.Add( New System.Data.SqlClient.SqlP arameter(" @DSTLINK", System.Data.SqlDbType.Deci mal, 5, System.Data.ParameterDirec tion.Input , False, CType(7, Byte), CType(0, Byte), "DSTLINK", System.Data.DataRowVersion .Current, Nothing))
'
'DataSet11
'
Me.DataSet11.DataSetName = "DataSet1"
Me.DataSet11.Locale = New System.Globalization.Cultu reInfo("en -US")
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(576, 459)
Me.Controls.Add(Me.Button1 )
Me.Name = "Form1"
Me.Text = "Form1"
CType(Me.DataSet11, System.ComponentModel.ISup portInitia lize).EndI nit()
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
SqlDataAdapter1.Fill(DataS et11)
End Sub
End Class
This results in the system error as soon as the page loads. The SQL server is SQL 2005. The version of VB.NET is 1.1 sp1
Please advise.
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.ICon
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents SqlConnection1 As System.Data.SqlClient.SqlC
Friend WithEvents SqlDataAdapter1 As System.Data.SqlClient.SqlD
Friend WithEvents Button1 As System.Windows.Forms.Butto
Friend WithEvents SqlSelectCommand1 As System.Data.SqlClient.SqlC
Friend WithEvents SqlInsertCommand1 As System.Data.SqlClient.SqlC
Friend WithEvents DataSet11 As ORStudentCreate.DataSet1
<System.Diagnostics.Debugg
Me.SqlConnection1 = New System.Data.SqlClient.SqlC
Me.SqlDataAdapter1 = New System.Data.SqlClient.SqlD
Me.Button1 = New System.Windows.Forms.Butto
Me.SqlSelectCommand1 = New System.Data.SqlClient.SqlC
Me.SqlInsertCommand1 = New System.Data.SqlClient.SqlC
Me.DataSet11 = New ORStudentCreate.DataSet1
CType(Me.DataSet11, System.ComponentModel.ISup
Me.SuspendLayout()
'
'SqlConnection1
'
Me.SqlConnection1.Connecti
"persist security info=False;initial catalog=DI"
'
'SqlDataAdapter1
'
Me.SqlDataAdapter1.InsertC
Me.SqlDataAdapter1.SelectC
Me.SqlDataAdapter1.TableMa
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(256, 400)
Me.Button1.Name = "Button1"
Me.Button1.TabIndex = 1
Me.Button1.Text = "Button1"
'
'SqlSelectCommand1
'
Me.SqlSelectCommand1.Comma
"NTGUARD, MAILADDR, CITY, ZIPCODE, STATE, TELEPHONE, BIRTHPLACE, HOMELNG, PRIMARY" & _
"LNG, DSTLINK FROM SASI.ADST WHERE (STATUS = '')"
Me.SqlSelectCommand1.Conne
'
'SqlInsertCommand1
'
Me.SqlInsertCommand1.Comma
", BIRTHDATE, PRNTGUARD, MAILADDR, CITY, ZIPCODE, STATE, TELEPHONE, BIRTHPLACE, H" & _
"OMELNG, PRIMARYLNG, DSTLINK) VALUES (@STATUS, @SCHOOLNUM, @LASTNAME, @FIRSTNAME," & _
" @MIDDLENAME, @PERMNUM, @BIRTHDATE, @PRNTGUARD, @MAILADDR, @CITY, @ZIPCODE, @STA" & _
"TE, @TELEPHONE, @BIRTHPLACE, @HOMELNG, @PRIMARYLNG, @DSTLINK); SELECT STATUS, SC" & _
"HOOLNUM, LASTNAME, FIRSTNAME, MIDDLENAME, PERMNUM, BIRTHDATE, PRNTGUARD, MAILADD" & _
"R, CITY, ZIPCODE, STATE, TELEPHONE, BIRTHPLACE, HOMELNG, PRIMARYLNG, DSTLINK FRO" & _
"M SASI.ADST"
Me.SqlInsertCommand1.Conne
Me.SqlInsertCommand1.Param
Me.SqlInsertCommand1.Param
Me.SqlInsertCommand1.Param
Me.SqlInsertCommand1.Param
Me.SqlInsertCommand1.Param
Me.SqlInsertCommand1.Param
Me.SqlInsertCommand1.Param
Me.SqlInsertCommand1.Param
Me.SqlInsertCommand1.Param
Me.SqlInsertCommand1.Param
Me.SqlInsertCommand1.Param
Me.SqlInsertCommand1.Param
Me.SqlInsertCommand1.Param
Me.SqlInsertCommand1.Param
Me.SqlInsertCommand1.Param
Me.SqlInsertCommand1.Param
Me.SqlInsertCommand1.Param
'
'DataSet11
'
Me.DataSet11.DataSetName = "DataSet1"
Me.DataSet11.Locale = New System.Globalization.Cultu
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(576, 459)
Me.Controls.Add(Me.Button1
Me.Name = "Form1"
Me.Text = "Form1"
CType(Me.DataSet11, System.ComponentModel.ISup
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
SqlDataAdapter1.Fill(DataS
End Sub
End Class
This results in the system error as soon as the page loads. The SQL server is SQL 2005. The version of VB.NET is 1.1 sp1
Please advise.
try a simpler query like this:
Me.SqlSelectCommand1.Comma ndText = "SELECT STATUS, SCHOOLNUM, LASTNAME, FIRSTNAME FROM SASI.ADST WHERE (STATUS = '')"
Me.SqlSelectCommand1.Comma
ASKER
That was actually not the problem. The problem involved saving the password for the connection. Do you know how to save it so that it is not readable in compiled sourcecode?
Here's a hint, go grab yourself a copy of vs2005 express and run it with .net 2.0 all your problems will magically dissapear. Then you can encrypt your web.config which stores the passwords for connection strings which have saved me alot of time :)
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
It will if you view the source code in a hex editor... Unfortunately for this app I have to do it in 1.1 so that's the way it goes 8(
I am still having problems as my dataset will not create an update statement which I am confused about also...
I am still having problems as my dataset will not create an update statement which I am confused about also...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hex Editor thats true, i guess never really thought of that since i encrypt all my connection strings anyway > :)
I have some old projects in 1.1, and i mean some really old ones but with some basic adapters i used to specify the parameters like this since your doing a Fill im under the indication that you have already set the parameters.
'----------- Porition of Code
Dim dtScanner As DataTable
Dim dtScannerRow As DataRow
dtScanner = Scannerds1.Tables("tblWebO rders")
SCANDA.SelectCommand.Param eters(0).V alue = "True"
Scannerds1.Tables("tblWebO rders").Cl ear()
SCANDA.Fill(Scannerds1, "tblWebOrders")
'------------------------- --
This code was just something quick and simple it sets a parameter to a value, up in your code you have parameters being used.
You need to set each one, since i haven't seen any code where you have set these values for your select command, so incase you haven't set your parameters hope that helps.
I have some old projects in 1.1, and i mean some really old ones but with some basic adapters i used to specify the parameters like this since your doing a Fill im under the indication that you have already set the parameters.
'----------- Porition of Code
Dim dtScanner As DataTable
Dim dtScannerRow As DataRow
dtScanner = Scannerds1.Tables("tblWebO
SCANDA.SelectCommand.Param
Scannerds1.Tables("tblWebO
SCANDA.Fill(Scannerds1, "tblWebOrders")
'-------------------------
This code was just something quick and simple it sets a parameter to a value, up in your code you have parameters being used.
You need to set each one, since i haven't seen any code where you have set these values for your select command, so incase you haven't set your parameters hope that helps.
ASKER
What I am not understanding is when I set up a SQLDataAdapter and attempt to configure it it will not generate the update, insert, or delete code it returns an error. The user for now is sa so permissions on the sql2005 database are not the issue. Why is .NET refusing to generate the above functions?
Just for testing sake, im about to go into a meeting could you try using a OLE adapter. I should be back in about 2 hrs or so.
One thought though, is there a primary key in the table? Usually tables will not allow generation of updates if there is no primary key.
Im back briefly,
Had a chance to try the ole or check the primary key?
Had a chance to try the ole or check the primary key?
Hi
As darkpriest states you need to define primary key.
Here is a small simplyfied ole code you can test out ! allthough if implemented in a larger solution then watch the scope for the commandbuilder
Dim pk(0) As DataColumn'define a primarykey collum
Dim cbSqlDataAdapter1 As OleDb.OleDbCommandBuilder 'define the command builder
Dim sId As Integer 'variabel to hold the found primarykey in the dataset
Dim sSql As String
Dim TmpStr As String
Dim oDatarow As DataRow
-------------------------- ---------- ---------- -------
m_cn.Open() 'open the connection
DataSet11.Clear()
'fill the dataset and setup the dataadapter
sSql = "SELECT Priority,Id,Firmname,Maila ddress,Fna me,Lname,K atagori FROM tblname"
SqlDataAdapter1.SelectComm and = New OleDb.OleDbCommand(sSql, m_cn)
SqlDataAdapter1.Fill(DataS et11, "tblname")
DataSet11.Tables("tblname" ).Columns( "Id").Auto Increment = True
pk(0) = DataSet11.Tables("tblname" ).Columns( "Id") '<--- the name collumname of your primary key
DataSet11.Tables("tblname" ).PrimaryK ey = pk
m_cn.Close()
-------------------------- ---------- ---------- ------
' do the UPDATE to the datasource ! all the modifications made to the dataset "insert , update , delete"
Public Sub updatetblname()
cbSqlDataAdapter1 = New OleDb.OleDbCommandBuilder( SqlDataAda pter1)
SqlDataAdapter1.Update(Dat aSet11, "tblname")
End Sub
-------------------------- ---------- ---------- ----------
Example ...
'loop through the dataset collum (6) to see if a match is found to conditon = TmpStr
TmpStr = "some condition"
For Each oDatarow In DataSet11.Tables("tblname" ).Rows
If oDatarow.Item(6) = TmpStr Then
sId = oDatarow.Item(1)'the collum with primary
DataSet11.Tables("tblname" ).Rows.Fin d(sId)' find the particular row with that primary
oDatarow.Delete()
End If
Next
updatetblname()' call the update sub
-------------------------- ---------- ---------- ------
vbturbo
As darkpriest states you need to define primary key.
Here is a small simplyfied ole code you can test out ! allthough if implemented in a larger solution then watch the scope for the commandbuilder
Dim pk(0) As DataColumn'define a primarykey collum
Dim cbSqlDataAdapter1 As OleDb.OleDbCommandBuilder 'define the command builder
Dim sId As Integer 'variabel to hold the found primarykey in the dataset
Dim sSql As String
Dim TmpStr As String
Dim oDatarow As DataRow
--------------------------
m_cn.Open() 'open the connection
DataSet11.Clear()
'fill the dataset and setup the dataadapter
sSql = "SELECT Priority,Id,Firmname,Maila
SqlDataAdapter1.SelectComm
SqlDataAdapter1.Fill(DataS
DataSet11.Tables("tblname"
pk(0) = DataSet11.Tables("tblname"
DataSet11.Tables("tblname"
m_cn.Close()
--------------------------
' do the UPDATE to the datasource ! all the modifications made to the dataset "insert , update , delete"
Public Sub updatetblname()
cbSqlDataAdapter1 = New OleDb.OleDbCommandBuilder(
SqlDataAdapter1.Update(Dat
End Sub
--------------------------
Example ...
'loop through the dataset collum (6) to see if a match is found to conditon = TmpStr
TmpStr = "some condition"
For Each oDatarow In DataSet11.Tables("tblname"
If oDatarow.Item(6) = TmpStr Then
sId = oDatarow.Item(1)'the collum with primary
DataSet11.Tables("tblname"
oDatarow.Delete()
End If
Next
updatetblname()' call the update sub
--------------------------
vbturbo
ASKER
I guess I should state the entire scope of what I am doing. I am working against a database that CANNOT be modified in any way. If there is no primary key, that is how it must remain and in the table in question that is true. So if I hand code the connection etc is that still using ADO.NET? I thought the point of .NET was to ease database programming by allowing you to drag components to the designer.. If I have to hand code it all that's fine but it seems to me that .NET is not all it is cracked up to be. If I hand code this (Even without a primary key) I will successfully be able to add and update records so why won't the designer just warn about it, but still create the code?
Hi
I belive that when using the designer to generate your " update delete " statements it would need a primary key to create such statements/methods for you,
although it can create "select and insert " statements under your mentioned problem description.
But without an unique identifier (pk) you wount be able to acomplish that.
It would be fair to say that , if there is a ambiguos possibility then the designer wount create your desired request. Such thing doesn't exist in any progamming langues.
And yes off course you hand write code to work around/acomplish that, what the designer wount do for you.
Also you seem to know that designers are a bit limited in some regards.
I personally belive there is benefits and disadvantece useing ado.net "most benefits"
The greatest one in my humble opinion is useing dataset's , you can make any manipulation to without makeing/addressing a connection request to the database
until you are done with all your data manipulation and then in the END, do one final request to the database namely ...updateing all the modifications you made
to the dataset
Answer to your question
>>>so why won't the designer just warn about it, but still create the code?
As mentioned above it creates the insert and select methods for you and you would also have seen 2 warnings (yellow once)
SO that why the designer still creates the code for you.(thogh it is limited)
I belive that when using the designer to generate your " update delete " statements it would need a primary key to create such statements/methods for you,
although it can create "select and insert " statements under your mentioned problem description.
But without an unique identifier (pk) you wount be able to acomplish that.
It would be fair to say that , if there is a ambiguos possibility then the designer wount create your desired request. Such thing doesn't exist in any progamming langues.
And yes off course you hand write code to work around/acomplish that, what the designer wount do for you.
Also you seem to know that designers are a bit limited in some regards.
I personally belive there is benefits and disadvantece useing ado.net "most benefits"
The greatest one in my humble opinion is useing dataset's , you can make any manipulation to without makeing/addressing a connection request to the database
until you are done with all your data manipulation and then in the END, do one final request to the database namely ...updateing all the modifications you made
to the dataset
Answer to your question
>>>so why won't the designer just warn about it, but still create the code?
As mentioned above it creates the insert and select methods for you and you would also have seen 2 warnings (yellow once)
SO that why the designer still creates the code for you.(thogh it is limited)
ASKER
Well with that said I will just hand code the connections etc and not drag and drop. Thanks for your input!
-D-
-D-
what vbturbo said ;)
which error? can you show your code?
Cheers!