Click here to Skip to main content
15,887,304 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: connecting gmail using IMAP in VB.NET? Pin
Mike Ellison4-Aug-09 3:17
Mike Ellison4-Aug-09 3:17 
QuestionBest practices for common routines Pin
supercat93-Aug-09 12:36
supercat93-Aug-09 12:36 
AnswerRe: Best practices for common routines Pin
Christian Graus3-Aug-09 13:39
protectorChristian Graus3-Aug-09 13:39 
AnswerRe: Best practices for common routines Pin
Mycroft Holmes3-Aug-09 13:56
professionalMycroft Holmes3-Aug-09 13:56 
GeneralRe: Best practices for common routines Pin
supercat94-Aug-09 5:46
supercat94-Aug-09 5:46 
GeneralRe: Best practices for common routines Pin
nlarson114-Aug-09 7:13
nlarson114-Aug-09 7:13 
GeneralRe: Best practices for common routines Pin
Mycroft Holmes4-Aug-09 16:08
professionalMycroft Holmes4-Aug-09 16:08 
QuestionVB-Access: Syntax error in INSERT INTO command Pin
Amanjot3-Aug-09 10:58
Amanjot3-Aug-09 10:58 
I am using following code to populate dataTable and then updating Access Table. I am getting error "OleDbException was unhandled" "Syntax error in INSERT INTO statement.

Any help would be appreciated.

Thanks,

Aman

<br />
    Private Sub dataGridAccess()<br />
<br />
        Dim connString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & AccessFile<br />
        Dim myConnection As OleDbConnection = New OleDbConnection<br />
        myConnection.ConnectionString = connString<br />
        myConnection.Open()<br />
<br />
<br />
        Dim myTable As String = "RealTimeWQActual"<br />
        Dim myCmd As String = "Select * from " & myTable & " ORDER BY sdate"<br />
        ' create a data adapter <br />
        Dim da As OleDbDataAdapter<br />
        Try<br />
            da = New OleDbDataAdapter(myCmd, myConnection)<br />
        Catch ex As Exception    ' Catch the error.<br />
            MsgBox(ex.ToString)   ' Show friendly error message.<br />
        End Try<br />
<br />
        MsgBox(myTable & "  " & myCmd)<br />
        ''Dim dr As New OleDbDataReader<br />
        ' Create command builder<br />
        Dim CB As OleDbCommandBuilder = New OleDbCommandBuilder(da)<br />
        ' create a new dataset <br />
        Dim ds As DataSet = New DataSet<br />
        ' fill dataset <br />
        da.Fill(ds, myTable)<br />
        ' Insert code to populate the DataTable with rows.<br />
        ' Set the DataSource and DataMember of the DataGrid control.<br />
        DataGrid1.SetDataBinding(ds, myTable)<br />
<br />
        Dim dt As DataTable = ds.Tables(myTable)<br />
        Dim rrows = dt.Rows.Count<br />
        MsgBox("rrows= " & rrows)<br />
<br />
        ' NewRow to create a DataRow.<br />
        Dim row As DataRow<br />
        row = dt.NewRow()<br />
<br />
        ' Then add the new row to the collection.<br />
        row("SDATE") = "1"<br />
        row("STIME") = "1"<br />
        row("Parameter") = "1"<br />
        row("Value") = "1"<br />
        row("d1") = "1"<br />
        row("d2") = "1"<br />
<br />
        dt.Rows.Add(row)<br />
        '**** error comes at the next step ***<br />
        da.Update(ds, myTable)<br />
        '**** Program runs without the previous step and dataTable shows the added row<br />
        myConnection.Close()<br />
<br />
<br />
    End Sub<br />

AnswerRe: VB-Access: Syntax error in INSERT INTO command Pin
Christian Graus3-Aug-09 11:17
protectorChristian Graus3-Aug-09 11:17 
AnswerRe: VB-Access: Syntax error in INSERT INTO command Pin
Paramu19733-Aug-09 21:16
Paramu19733-Aug-09 21:16 
AnswerRe: VB-Access: Syntax error in INSERT INTO command Pin
Hristo-Bojilov4-Aug-09 7:34
Hristo-Bojilov4-Aug-09 7:34 
QuestionList all active windows Pin
NewbieDave3-Aug-09 10:02
NewbieDave3-Aug-09 10:02 
AnswerRe: List all active windows Pin
Christian Graus3-Aug-09 10:32
protectorChristian Graus3-Aug-09 10:32 
AnswerRe: List all active windows Pin
Dave Kreskowiak3-Aug-09 10:36
mveDave Kreskowiak3-Aug-09 10:36 
GeneralRe: List all active windows Pin
Christian Graus3-Aug-09 10:44
protectorChristian Graus3-Aug-09 10:44 
GeneralRe: List all active windows Pin
NewbieDave3-Aug-09 11:05
NewbieDave3-Aug-09 11:05 
GeneralRe: List all active windows Pin
Christian Graus3-Aug-09 11:17
protectorChristian Graus3-Aug-09 11:17 
QuestionObject disposed when trying to assign column width Pin
Hypermommy3-Aug-09 9:27
Hypermommy3-Aug-09 9:27 
AnswerRe: Object disposed when trying to assign column width Pin
Dave Kreskowiak3-Aug-09 10:33
mveDave Kreskowiak3-Aug-09 10:33 
GeneralRe: Object disposed when trying to assign column width Pin
Hypermommy3-Aug-09 10:48
Hypermommy3-Aug-09 10:48 
GeneralRe: Object disposed when trying to assign column width Pin
Dave Kreskowiak3-Aug-09 16:21
mveDave Kreskowiak3-Aug-09 16:21 
GeneralRe: Object disposed when trying to assign column width Pin
Hypermommy3-Aug-09 23:03
Hypermommy3-Aug-09 23:03 
GeneralRe: Object disposed when trying to assign column width Pin
Luc Pattyn3-Aug-09 10:50
sitebuilderLuc Pattyn3-Aug-09 10:50 
QuestionCustomPanel: MenuStrip and Panel Pin
eusta3-Aug-09 9:13
eusta3-Aug-09 9:13 
AnswerRe: CustomPanel: MenuStrip and Panel Pin
Dave Kreskowiak3-Aug-09 10:30
mveDave Kreskowiak3-Aug-09 10:30 

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.