Click here to Skip to main content
16,005,281 members
Home / Discussions / Database
   

Database

 
GeneralRe: quering on views Pin
Mekong River17-Jul-04 4:53
Mekong River17-Jul-04 4:53 
GeneralRe: quering on views Pin
blankg17-Jul-04 9:51
blankg17-Jul-04 9:51 
GeneralRe: quering on views Pin
Mekong River17-Jul-04 18:18
Mekong River17-Jul-04 18:18 
GeneralRe: quering on views Pin
blankg17-Jul-04 21:35
blankg17-Jul-04 21:35 
GeneralInput string was not in a correct format Pin
DotNet15-Jul-04 18:27
DotNet15-Jul-04 18:27 
GeneralRe: Input string was not in a correct format Pin
Colin Angus Mackay15-Jul-04 22:19
Colin Angus Mackay15-Jul-04 22:19 
GeneralRe: Input string was not in a correct format Pin
Colin Angus Mackay16-Jul-04 2:22
Colin Angus Mackay16-Jul-04 2:22 
GeneralRe: Input string was not in a correct format Pin
DotNet16-Jul-04 3:57
DotNet16-Jul-04 3:57 
Colin...... the code is here...

Sub DataGrid_Update(Sender As Object, E As DataGridCommandEventArgs)

' update the database with the new values

' get the edit text boxes
Dim id As String = (CType(e.Item.Cells(2).Controls(0), TextBox)).Text
Dim lname As String = (CType(e.Item.Cells(3).Controls(0), TextBox)).Text

'********************** Problem is here below here...
Dim hprice As String = (Ctype(e.Item.Cells(4).Controls(0), TextBox)).Text
Dim hdesc As String = (CType(e.Item.Cells(5).Controls(0), TextBox)).Text

Dim myConnection As New SqlConnection(ConnectionString)
Dim UpdateCommand As SqlCommand = new SqlCommand()
UpdateCommand.Connection = myConnection

If AddingNew = True Then
UpdateCommand.CommandText = "INSERT INTO Hardware(HardwareID, Name, Price, Description) VALUES (@HardwareID, @Name, @Price, @Description)"
Else
UpdateCommand.CommandText = "UPDATE Hardware SET HardwareID = @HardwareID, Name = @Name, Price = @Price, Description = @Description WHERE HardwareID = @HardwareID"
End If

UpdateCommand.Parameters.Add("@HardwareID", SqlDbType.Varchar, 5).Value = id
UpdateCommand.Parameters.Add("@Name", SqlDbType.VarChar, 50).Value = lname
'************************************** Problem is here below here...
UpdateCommand.Parameters.Add("@Price", SqlDbType.Money, 8).Value = hprice
UPdateCommand.Parameters.Add("@Description", SqlDbType.VarChar, 100).Value = hdesc
' execute the command
Try
myConnection.Open()
UpdateCommand.ExecuteNonQuery()

Catch ex as Exception
Message.Text = ex.ToString()

Finally
myConnection.Close()

End Try

' Resort the grid for new records
If AddingNew = True Then
DataGrid1.CurrentPageIndex = 0
AddingNew = false
End If

' rebind the grid
DataGrid1.EditItemIndex = -1
BindGrid()

End Sub


Questioncan i get some operation infomation from SQLsrv2k ? Pin
fu015-Jul-04 15:58
fu015-Jul-04 15:58 
AnswerRe: can i get some operation infomation from SQLsrv2k ? Pin
RichardGrimmer15-Jul-04 23:28
RichardGrimmer15-Jul-04 23:28 
GeneralRe: can i get some operation infomation from SQLsrv2k ? Pin
fu017-Jul-04 15:39
fu017-Jul-04 15:39 
GeneralRe: can i get some operation infomation from SQLsrv2k ? Pin
RichardGrimmer19-Jul-04 5:40
RichardGrimmer19-Jul-04 5:40 
QuestionIs This Complex Update Possible? Pin
perlmunger15-Jul-04 11:38
perlmunger15-Jul-04 11:38 
AnswerRe: Is This Complex Update Possible? Pin
Colin Angus Mackay15-Jul-04 12:03
Colin Angus Mackay15-Jul-04 12:03 
GeneralRe: Is This Complex Update Possible? Pin
perlmunger15-Jul-04 12:21
perlmunger15-Jul-04 12:21 
GeneralRe: Is This Complex Update Possible? Pin
Colin Angus Mackay15-Jul-04 12:29
Colin Angus Mackay15-Jul-04 12:29 
GeneralRe: Is This Complex Update Possible? Pin
perlmunger15-Jul-04 12:39
perlmunger15-Jul-04 12:39 
GeneralRe: Is This Complex Update Possible? Pin
perlmunger15-Jul-04 13:02
perlmunger15-Jul-04 13:02 
GeneralRe: Is This Complex Update Possible? Pin
Colin Angus Mackay15-Jul-04 13:07
Colin Angus Mackay15-Jul-04 13:07 
AnswerRe: Is This Complex Update Possible? Pin
dishanf19-Jul-04 1:57
dishanf19-Jul-04 1:57 
GeneralRe: Is This Complex Update Possible? Pin
dishanf19-Jul-04 2:03
dishanf19-Jul-04 2:03 
GeneralWhat's wrong with this script from a Wrox Book Pin
mtbjr15-Jul-04 2:18
mtbjr15-Jul-04 2:18 
GeneralRe: What's wrong with this script from a Wrox Book Pin
Michael Potter15-Jul-04 5:23
Michael Potter15-Jul-04 5:23 
GeneralRe: What's wrong with this script from a Wrox Book Pin
Steven Campbell15-Jul-04 7:01
Steven Campbell15-Jul-04 7:01 
GeneralRe: What's wrong with this script from a Wrox Book Pin
mtbjr15-Jul-04 16:29
mtbjr15-Jul-04 16:29 

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.