Click here to Skip to main content
16,004,919 members
Home / Discussions / Visual Basic
   

Visual Basic

 
Questionhow to get any file in web sever Pin
nguyen van son20-Sep-06 17:03
nguyen van son20-Sep-06 17:03 
AnswerRe: how to get any file in web sever Pin
Dave Kreskowiak21-Sep-06 4:54
mveDave Kreskowiak21-Sep-06 4:54 
QuestionClickable row function Pin
mellvincent20-Sep-06 16:28
mellvincent20-Sep-06 16:28 
AnswerRe: Clickable row function Pin
Dave Kreskowiak21-Sep-06 4:41
mveDave Kreskowiak21-Sep-06 4:41 
QuestionRecommendation for displaying large log files? Pin
Todd Beaulieu20-Sep-06 10:48
Todd Beaulieu20-Sep-06 10:48 
QuestionSystem time range Pin
Silver-Grey20-Sep-06 10:26
Silver-Grey20-Sep-06 10:26 
AnswerRe: System time range Pin
EvoFreak20-Sep-06 11:32
EvoFreak20-Sep-06 11:32 
QuestionUpdate Data in a Datagrid Pin
Larry White20-Sep-06 10:01
Larry White20-Sep-06 10:01 
I am having difficulty getting the underlying SQL data to update when a change is made to the datagrid. The change is made using a combobox, and allows the proper selection of 1 of the 3 choices, but I can't seem to get the syntax/code right to update the table. Here is my current code:

Public Sub comboControl_SelectedValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles comboControl.SelectedValueChanged
grdVW_AllOpen(hitTestGrid.Row, hitTestGrid.Column) = comboControl.Text

Dim sc1 As New SqlCommand
Dim sCnnStr As String
sCnnStr = "Data Source=" & SQL_SERVER & ";Initial Catalog=" & DATABASE & ";User id=" & USER_ID & ";Password=" & PWD
Dim sqlConn As New SqlConnection(sCnnStr)
sc1.Connection = sqlConn
sc1.CommandType = CommandType.Text
sc1.CommandText = "UPDATE dbo.Chits_Backup SET Status = '" & comboControl.Text & "'" & ", LastName = @LastName, FirstName = @FirstName, DateofRequest = @DateofRequest, FromDate = @FromDate, ToDate = @ToDate, Days = @Days, NatureofRequest = @NatureofRequest WHERE ID = @ID"
Dim cmd As New SqlClient.SqlCommand(sc1.CommandText)
'Create the sql command object and set its command type to execute the sql query to get the results

sc1.Parameters.Add("@Status", SqlDbType.NVarChar, 50, "Status").Value = comboControl.Text
sc1.Parameters.Add("@LastName", SqlDbType.NVarChar, 50, "LastName").Value = "@LastName"
sc1.Parameters.Add("@FirstName", SqlDbType.NVarChar, 50, "FirstName").Value = "@FirstName"
sc1.Parameters.Add("@DateofRequest", SqlDbType.NVarChar, 50, "DateofRequest").Value = "@DateofRequest"
sc1.Parameters.Add("@FromDate", SqlDbType.DateTime, 8, "FromDate").Value = "@FromDate"
sc1.Parameters.Add("@ToDate", SqlDbType.DateTime, 8, "ToDate").Value = "@ToDate"
sc1.Parameters.Add("@Days", SqlDbType.NVarChar, 50, "Days").Value = "@Days"
sc1.Parameters.Add("@NatureofRequest", SqlDbType.NVarChar, 50, "NatureofRequest").Value = "@NatureofRequest"

Dim myParm2 As SqlParameter = sc1.Parameters.Add("@ID", SqlDbType.Int, 4, "ID")
myParm2.SourceVersion = DataRowVersion.Original

sqlConn.Open()
Try
sc1.ExecuteNonQuery()
Catch ex As SqlException
MsgBox(ex.Message().ToString())
End Try
sqlConn.Close()

I know it has to do with the handling of variables, but can't narrow it down.

Thank you,
LWhiteSmile | :)

LWhite

QuestionAccesing database [MS ACCESS] Pin
hariram2820-Sep-06 6:26
hariram2820-Sep-06 6:26 
AnswerRe: Accesing database [MS ACCESS] Pin
DEWright_CA20-Sep-06 10:59
DEWright_CA20-Sep-06 10:59 
AnswerRe: Accesing database [MS ACCESS] Pin
Dave Kreskowiak20-Sep-06 14:01
mveDave Kreskowiak20-Sep-06 14:01 
GeneralRe: Accesing database [MS ACCESS] Pin
hariram2821-Sep-06 7:26
hariram2821-Sep-06 7:26 
AnswerRe: Accesing database [MS ACCESS] Pin
Dixon Baptista21-Sep-06 2:54
Dixon Baptista21-Sep-06 2:54 
GeneralRe: Accesing database [MS ACCESS] Pin
hariram2821-Sep-06 7:28
hariram2821-Sep-06 7:28 
QuestionDatabinding Pin
Tomic20-Sep-06 6:02
Tomic20-Sep-06 6:02 
AnswerRe: Databinding Pin
Christian Graus20-Sep-06 11:53
protectorChristian Graus20-Sep-06 11:53 
QuestionAccessing a website Pin
KreativeKai20-Sep-06 5:20
professionalKreativeKai20-Sep-06 5:20 
AnswerRe: Accessing a website Pin
Dave Kreskowiak20-Sep-06 5:46
mveDave Kreskowiak20-Sep-06 5:46 
GeneralRe: Accessing a website Pin
KreativeKai20-Sep-06 6:30
professionalKreativeKai20-Sep-06 6:30 
GeneralRe: Accessing a website Pin
Dave Kreskowiak20-Sep-06 6:50
mveDave Kreskowiak20-Sep-06 6:50 
GeneralRe: Accessing a website Pin
KreativeKai20-Sep-06 7:47
professionalKreativeKai20-Sep-06 7:47 
GeneralRe: Accessing a website Pin
Dave Kreskowiak20-Sep-06 8:37
mveDave Kreskowiak20-Sep-06 8:37 
QuestionLike to Re install Pin
kalyanPaladugu20-Sep-06 5:18
kalyanPaladugu20-Sep-06 5:18 
Question.NET Binding Navigator [modified] Pin
nlindley720-Sep-06 4:28
nlindley720-Sep-06 4:28 
Questionhow to connect mysql database to vb.net 5 Pin
POIKAYIL20-Sep-06 4:06
POIKAYIL20-Sep-06 4:06 

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.