Click here to Skip to main content
15,881,684 members
Home / Discussions / Database
   

Database

 
GeneralRe: Help with SQL query Pin
Mycroft Holmes31-May-09 17:24
professionalMycroft Holmes31-May-09 17:24 
GeneralRe: Help with SQL query Pin
smcnulty20004-Jun-09 1:24
smcnulty20004-Jun-09 1:24 
AnswerRe: Help with SQL query Pin
Niladri_Biswas2-Jul-09 0:25
Niladri_Biswas2-Jul-09 0:25 
Questionget the inserted GUID Pin
Mohammad Al Hoss30-May-09 2:18
Mohammad Al Hoss30-May-09 2:18 
AnswerRe: get the inserted GUID Pin
Mycroft Holmes30-May-09 23:15
professionalMycroft Holmes30-May-09 23:15 
Questionhow do i use a primary key auto-generated in a table as a foreign key in another table? Pin
ChiSmile29-May-09 21:10
ChiSmile29-May-09 21:10 
AnswerRe: how do i use a primary key auto-generated in a table as a foreign key in another table? Pin
Mycroft Holmes29-May-09 23:40
professionalMycroft Holmes29-May-09 23:40 
GeneralRe: how do i use a primary key auto-generated in a table as a foreign key in another table? Pin
ChiSmile30-May-09 0:29
ChiSmile30-May-09 0:29 
Thanks alot mycroft holmes!!. but the following is my idea, i dont know y the ExecuteScalar method is returning nothing i guess.keeps throwing exception about type conversion.Can anyone help me!


Try

    LoadData()

    ' Configure and execute the command.
    comd = New System.Data.SqlClient.SqlCommand("insert into Data_Modification (Patient_ID, Date_Collected, Wrong_Data_Entry_Date, Data_Field, Provider)" & _
        " values (@PatRep_ID, @DateCol, @WrngDataDate, @Data_Field, @Provider)", con)

    'comd.Connection = con
    Dim paraPatId As SqlParameter = comd.Parameters.Add("@PatRep_ID", repDatPatID.Text)
    Dim paraDte As SqlParameter = comd.Parameters.Add("@DateCol", repDatColTmePikar2.Value.ToShortDateString)
    Dim paraWrngD As SqlParameter = comd.Parameters.Add("@WrngDataDate", repWDatEDaTmePika.Value.ToShortDateString)
    Dim paraDaFld As SqlParameter = comd.Parameters.Add("@Data_Field", repDatDFldCmBx.Text)
    Dim paraProv As SqlParameter = comd.Parameters.Add("@Provider", repDatProvTbx.Text)
    comd.ExecuteNonQuery()

Catch ex As SqlException
    MsgBox(ex.Message.ToString())
Finally
    con.Close()
End Try


Try

    LoadData()
    comd = New System.Data.SqlClient.SqlCommand("select distinct scope_identity()as Integer from Data_Modification", con)
    Dim key As Integer = comd.ExecuteScalar
    con.Close()


    LoadData()

    ' Configure and execute the command.
    comd = New System.Data.SqlClient.SqlCommand("insert into Modification_copy (data_mod_ID,Date_Collected, Data_Attribute,Correct_data_Value)" & _
        " values (@DataModIdD,@retDateCol, @DatAtt, @CorDaVal)", con)

    'comd.Connection = con
    Dim paraModID As SqlParameter = comd.Parameters.Add("@DataModIdD", key)
    Dim paraDteCol As SqlParameter = comd.Parameters.Add("@retDateCol", repDatColTmePikar2.Value.ToShortDateString)
    Dim paraDAtt As SqlParameter = comd.Parameters.Add("@datAtt", repMorCmBx.Text)
    Dim paraCorDVa As SqlParameter = comd.Parameters.Add("@corDaVal", repMorTxb.Text)


      comd.ExecuteNonQuery()
    If MsgBox("Report successful!. Do you want to report more Data?", MsgBoxStyle.YesNo, "Confirmation!!!") _
    = Windows.Forms.DialogResult.Yes Then
        repMorDetPnl.Hide()
        repDatTabPg.Show()

    Else
        repMorDetPnl.Hide()
        vwPatient.Show()
    End If

Catch ex As SqlException
    MsgBox(ex.Message.ToString())
Finally
    con.Close()
End Try

GeneralRe: how do i use a primary key auto-generated in a table as a foreign key in another table? Pin
Mycroft Holmes30-May-09 0:48
professionalMycroft Holmes30-May-09 0:48 
GeneralRe: how do i use a primary key auto-generated in a table as a foreign key in another table? Pin
ChiSmile1-Jun-09 2:09
ChiSmile1-Jun-09 2:09 
GeneralRe: how do i use a primary key auto-generated in a table as a foreign key in another table? Pin
Mycroft Holmes1-Jun-09 3:33
professionalMycroft Holmes1-Jun-09 3:33 
GeneralRe: how do i use a primary key auto-generated in a table as a foreign key in another table? Pin
ChiSmile1-Jun-09 16:49
ChiSmile1-Jun-09 16:49 
GeneralRe: how do i use a primary key auto-generated in a table as a foreign key in another table? Pin
Mycroft Holmes1-Jun-09 17:17
professionalMycroft Holmes1-Jun-09 17:17 
Questionhow i can do this Pin
NNR_Noga29-May-09 4:22
NNR_Noga29-May-09 4:22 
AnswerRe: how i can do this Pin
Bassam Saoud29-May-09 4:43
Bassam Saoud29-May-09 4:43 
GeneralRe: how i can do this Pin
NNR_Noga29-May-09 5:15
NNR_Noga29-May-09 5:15 
GeneralRe: how i can do this Pin
Bassam Saoud29-May-09 5:29
Bassam Saoud29-May-09 5:29 
GeneralRe: how i can do this Pin
Mycroft Holmes29-May-09 23:44
professionalMycroft Holmes29-May-09 23:44 
QuestionNHibernate - Good or Bad Idea? Pin
Jacobus0129-May-09 3:00
Jacobus0129-May-09 3:00 
AnswerRe: NHibernate - Good or Bad Idea? Pin
Bassam Saoud29-May-09 4:50
Bassam Saoud29-May-09 4:50 
QuestionEDB Pin
ujjawal kumar27-May-09 23:24
ujjawal kumar27-May-09 23:24 
AnswerRe: EDB Pin
Bassam Saoud29-May-09 4:58
Bassam Saoud29-May-09 4:58 
QuestionEvent Viewer Pin
jonhbt27-May-09 22:51
jonhbt27-May-09 22:51 
AnswerRe: Event Viewer Pin
Garth J Lancaster28-May-09 0:06
professionalGarth J Lancaster28-May-09 0:06 
AnswerRe: Event Viewer Pin
Eddy Vluggen28-May-09 0:13
professionalEddy Vluggen28-May-09 0:13 

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.