Click here to Skip to main content
15,888,351 members
Home / Discussions / Database
   

Database

 
QuestionDataAdapter.Fill taking forever Pin
Luis Alonso Ramos10-Jan-06 15:59
Luis Alonso Ramos10-Jan-06 15:59 
AnswerRe: DataAdapter.Fill taking for ever Pin
nguyenvhn10-Jan-06 16:21
nguyenvhn10-Jan-06 16:21 
GeneralRe: DataAdapter.Fill taking forever Pin
Luis Alonso Ramos10-Jan-06 17:03
Luis Alonso Ramos10-Jan-06 17:03 
GeneralRe: DataAdapter.Fill taking for ever Pin
Luis Alonso Ramos11-Jan-06 12:43
Luis Alonso Ramos11-Jan-06 12:43 
NewsUpdate - still not working Pin
Luis Alonso Ramos11-Jan-06 15:00
Luis Alonso Ramos11-Jan-06 15:00 
GeneralRe: Update - still not working Pin
nguyenvhn11-Jan-06 21:25
nguyenvhn11-Jan-06 21:25 
AnswerRe: Update - still not working Pin
Luis Alonso Ramos12-Jan-06 6:48
Luis Alonso Ramos12-Jan-06 6:48 
QuestionI cannot update the Data grid fields for the following example: Pin
kenn_rosie10-Jan-06 6:44
kenn_rosie10-Jan-06 6:44 
I cannot update the Data grid fields for the following example:
The grid and 2 buttons are visable but I cannot mainpulate (update) the data



Imports System.Data.SqlClient
Public Class WebForm1
Inherits System.Web.UI.Page

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<system.diagnostics.debuggerstepthrough()> Private Sub InitializeComponent()
Me.cnPubs = New System.Data.SqlClient.SqlConnection
Me.daAuthors = New System.Data.SqlClient.SqlDataAdapter
Me.SqlSelectCommand1 = New System.Data.SqlClient.SqlCommand
Me.SqlInsertCommand1 = New System.Data.SqlClient.SqlCommand
Me.SqlUpdateCommand1 = New System.Data.SqlClient.SqlCommand
Me.SqlDeleteCommand1 = New System.Data.SqlClient.SqlCommand
Me.dsPubs = New ADO.dsPubs
CType(Me.dsPubs, System.ComponentModel.ISupportInitialize).BeginInit()
'
'cnPubs
'
Me.cnPubs.ConnectionString = "workstation id=DOZER;packet size=4096;integrated security=SSPI;data source=dozer;" & _
"persist security info=False;initial catalog=pubs"
'
'daAuthors
'
Me.daAuthors.DeleteCommand = Me.SqlDeleteCommand1
Me.daAuthors.InsertCommand = Me.SqlInsertCommand1
Me.daAuthors.SelectCommand = Me.SqlSelectCommand1
Me.daAuthors.TableMappings.AddRange(New System.Data.Common.DataTableMapping() {New System.Data.Common.DataTableMapping("Table", "authors", New System.Data.Common.DataColumnMapping() {New System.Data.Common.DataColumnMapping("au_id", "au_id"), New System.Data.Common.DataColumnMapping("au_lname", "au_lname"), New System.Data.Common.DataColumnMapping("au_fname", "au_fname")})})
Me.daAuthors.UpdateCommand = Me.SqlUpdateCommand1
'
'SqlSelectCommand1
'
Me.SqlSelectCommand1.CommandText = "SELECT au_id, au_lname, au_fname FROM authors"
Me.SqlSelectCommand1.Connection = Me.cnPubs
'
'SqlInsertCommand1
'
Me.SqlInsertCommand1.CommandText = "INSERT INTO authors(au_id, au_lname, au_fname) VALUES (@au_id, @au_lname, @au_fna" & _
"me); SELECT au_id, au_lname, au_fname FROM authors WHERE (au_id = @au_id)"
Me.SqlInsertCommand1.Connection = Me.cnPubs
Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@au_id", System.Data.SqlDbType.VarChar, 11, "au_id"))
Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@au_lname", System.Data.SqlDbType.VarChar, 40, "au_lname"))
Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@au_fname", System.Data.SqlDbType.VarChar, 20, "au_fname"))
'
'SqlUpdateCommand1
'
Me.SqlUpdateCommand1.CommandText = "UPDATE authors SET au_id = @au_id, au_lname = @au_lname, au_fname = @au_fname WHE" & _
"RE (au_id = @Original_au_id) AND (au_fname = @Original_au_fname) AND (au_lname =" & _
" @Original_au_lname); SELECT au_id, au_lname, au_fname FROM authors WHERE (au_id" & _
" = @au_id)"
Me.SqlUpdateCommand1.Connection = Me.cnPubs
Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@au_id", System.Data.SqlDbType.VarChar, 11, "au_id"))
Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@au_lname", System.Data.SqlDbType.VarChar, 40, "au_lname"))
Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@au_fname", System.Data.SqlDbType.VarChar, 20, "au_fname"))
Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_au_id", System.Data.SqlDbType.VarChar, 11, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "au_id", System.Data.DataRowVersion.Original, Nothing))
Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_au_fname", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "au_fname", System.Data.DataRowVersion.Original, Nothing))
Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_au_lname", System.Data.SqlDbType.VarChar, 40, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "au_lname", System.Data.DataRowVersion.Original, Nothing))
'
'SqlDeleteCommand1
'
Me.SqlDeleteCommand1.CommandText = "DELETE FROM authors WHERE (au_id = @Original_au_id) AND (au_fname = @Original_au_" & _
"fname) AND (au_lname = @Original_au_lname)"
Me.SqlDeleteCommand1.Connection = Me.cnPubs
Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_au_id", System.Data.SqlDbType.VarChar, 11, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "au_id", System.Data.DataRowVersion.Original, Nothing))
Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_au_fname", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "au_fname", System.Data.DataRowVersion.Original, Nothing))
Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_au_lname", System.Data.SqlDbType.VarChar, 40, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "au_lname", System.Data.DataRowVersion.Original, Nothing))
'
'dsPubs
'
Me.dsPubs.DataSetName = "dsPubs"
Me.dsPubs.Locale = New System.Globalization.CultureInfo("en-US")
CType(Me.dsPubs, System.ComponentModel.ISupportInitialize).EndInit()

End Sub
Protected WithEvents cnPubs As System.Data.SqlClient.SqlConnection
Protected WithEvents daAuthors As System.Data.SqlClient.SqlDataAdapter
Protected WithEvents SqlSelectCommand1 As System.Data.SqlClient.SqlCommand
Protected WithEvents SqlInsertCommand1 As System.Data.SqlClient.SqlCommand
Protected WithEvents SqlUpdateCommand1 As System.Data.SqlClient.SqlCommand
Protected WithEvents SqlDeleteCommand1 As System.Data.SqlClient.SqlCommand
Protected WithEvents dsPubs As ADO.dsPubs
Protected WithEvents DataGrid1 As System.Web.UI.WebControls.DataGrid
Protected WithEvents btnRefresh As System.Web.UI.WebControls.Button
Protected WithEvents btnSave As System.Web.UI.WebControls.Button

'NOTE: The following placeholder declaration is required by the Web Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub

#End Region

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here

dsPubs.Clear()
daAuthors.Fill(dsPubs)
DataGrid1.DataBind()

End Sub

Private Sub btnRefresh_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRefresh.Click
daAuthors.Fill(dsPubs.authors)

End Sub

Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
daAuthors.Update(dsPubs.authors)

End Sub
End Class
QuestionODBC - Getting table names ? Pin
Weckmann10-Jan-06 1:50
Weckmann10-Jan-06 1:50 
Question24hr Time Format Pin
tadhg889-Jan-06 23:56
tadhg889-Jan-06 23:56 
AnswerRe: 24hr Time Format Pin
Colin Angus Mackay10-Jan-06 0:19
Colin Angus Mackay10-Jan-06 0:19 
GeneralRe: 24hr Time Format Pin
tadhg8810-Jan-06 1:15
tadhg8810-Jan-06 1:15 
QuestionHelp for sql query(joins) Pin
rs_net9-Jan-06 18:20
rs_net9-Jan-06 18:20 
AnswerRe: Help for sql query(joins) Pin
Colin Angus Mackay9-Jan-06 20:52
Colin Angus Mackay9-Jan-06 20:52 
QuestionWhy the ODP.NET could not be installed? Pin
rushing9-Jan-06 15:25
rushing9-Jan-06 15:25 
QuestionSQL Server DataAdapter Pin
thebison9-Jan-06 10:02
thebison9-Jan-06 10:02 
QuestionRunning SQL server 2000 & 2005 side by side Pin
Tiger4569-Jan-06 1:00
Tiger4569-Jan-06 1:00 
AnswerRe: Running SQL server 2000 & 2005 side by side Pin
Colin Angus Mackay9-Jan-06 1:12
Colin Angus Mackay9-Jan-06 1:12 
GeneralRe: Running SQL server 2000 & 2005 side by side Pin
Tiger4569-Jan-06 1:46
Tiger4569-Jan-06 1:46 
GeneralRe: Running SQL server 2000 & 2005 side by side Pin
Colin Angus Mackay9-Jan-06 20:57
Colin Angus Mackay9-Jan-06 20:57 
GeneralRe: Running SQL server 2000 & 2005 side by side Pin
Tiger45610-Jan-06 17:24
Tiger45610-Jan-06 17:24 
GeneralRe: Running SQL server 2000 & 2005 side by side Pin
Colin Angus Mackay10-Jan-06 20:41
Colin Angus Mackay10-Jan-06 20:41 
GeneralRe: Running SQL server 2000 & 2005 side by side Pin
dl4gbe12-Jan-06 2:48
dl4gbe12-Jan-06 2:48 
QuestionRemote SQL Database Pin
HakunaMatada9-Jan-06 0:26
HakunaMatada9-Jan-06 0:26 
AnswerRe: Remote SQL Database Pin
Colin Angus Mackay9-Jan-06 1:14
Colin Angus Mackay9-Jan-06 1:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.