Click here to Skip to main content
15,889,315 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Problem with auto increment. Pin
nazimghori9-Mar-09 20:36
nazimghori9-Mar-09 20:36 
QuestionCetak Maklumat Pin
missgarfield9-Mar-09 18:09
missgarfield9-Mar-09 18:09 
AnswerRe: Cetak Maklumat Pin
dan!sh 9-Mar-09 18:10
professional dan!sh 9-Mar-09 18:10 
AnswerRe: Cetak Maklumat Pin
CPallini10-Mar-09 4:12
mveCPallini10-Mar-09 4:12 
Questionvb dot net Pin
anandkumarrs69-Mar-09 18:07
anandkumarrs69-Mar-09 18:07 
AnswerRe: vb dot net Pin
dan!sh 9-Mar-09 18:09
professional dan!sh 9-Mar-09 18:09 
AnswerRe: vb dot net Pin
Christian Graus9-Mar-09 18:32
protectorChristian Graus9-Mar-09 18:32 
Questionfail to add data into database... Pin
zaimah9-Mar-09 17:43
zaimah9-Mar-09 17:43 
hi there, im creating a windows form where it will read data in a file n extract the data into the database.. the data in the files are in this format :
<date> <runno><coop>
20090301,C4933,ASB02
20090301,C4933,BL689
20090301,C4933,BL707
20090301,C4933,BL714

my app will read the data and will put into the table "portal" - date, runNo, coop.. but when i try, theres no data inside the database. But if i try to display all the data from that file, it can be display. so the problem must be insert the data to the database.. pls check my coding if there's a mistake.. TQ..


Private Sub SEMAK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SEMAK.Click

       Dim fileName As String = "X:\COOPAYPC1\01032009\C4933"
       Dim lineNumber As Integer = 0

       Dim sr As StreamReader = New StreamReader(fileName)
       Dim conn As New SqlClient.SqlConnection("Data Source=MISKPI;User ID= sysadm;Password=sysadm;Initial Catalog=SPGA_Latihan;Persist Security Info=True")

       Dim date As String = ""
       Dim runNo As String = ""
       Dim coop As String = ""
       Dim line As String = ""

       Do
           line = sr.ReadLine()

           If line <> Nothing Then
               Try
                   date= line.Substring(0, 8).Trim()
                   runNo = line.Substring(9, 14).Trim()
                   coop = line.Substring(15).Trim()

               Catch ex As Exception
                   Console.Write(ex.ToString())
               End Try

               Dim strSQL As String = "INSERT INTO portal (date,runNo, coop) VALUES (@date, @runNo, @coop)"
               Dim cmd As New System.Data.SqlClient.SqlCommand(strSQL, conn)
               conn.Open()

               cmd.Parameters.Add(New SqlClient.SqlParameter("@tarikh", SqlDbType.Char, 8))
               cmd.Parameters("@date").Value = date

               cmd.Parameters.Add(New SqlClient.SqlParameter("@runNo",   SqlDbType.Char, 20))
               cmd.Parameters("@runNo").Value = runNo

               cmd.Parameters.Add(New SqlClient.SqlParameter("@coop",    SqlDbType.VarChar, 100))
               cmd.Parameters("@coop").Value = coop

               conn.Close()


           End If

       Loop Until line Is Nothing

       sr.Close()


   End Sub

AnswerRe: fail to add data into database... Pin
Yusuf9-Mar-09 17:53
Yusuf9-Mar-09 17:53 
GeneralRe: fail to add data into database... Pin
zaimah9-Mar-09 18:03
zaimah9-Mar-09 18:03 
GeneralRe: fail to add data into database... Pin
Christian Graus9-Mar-09 18:32
protectorChristian Graus9-Mar-09 18:32 
GeneralRe: fail to add data into database... Pin
zaimah9-Mar-09 18:53
zaimah9-Mar-09 18:53 
QuestionFormat Numbers in Visual Basic Listbox Pin
NMIB9-Mar-09 10:26
NMIB9-Mar-09 10:26 
AnswerRe: Format Numbers in Visual Basic Listbox Pin
0x3c09-Mar-09 10:56
0x3c09-Mar-09 10:56 
AnswerRe: Format Numbers in Visual Basic Listbox Pin
supercat99-Mar-09 11:29
supercat99-Mar-09 11:29 
GeneralRe: Format Numbers in Visual Basic Listbox Pin
0x3c09-Mar-09 11:31
0x3c09-Mar-09 11:31 
Questionget URL from previous web page Pin
edwin_nice9-Mar-09 5:32
edwin_nice9-Mar-09 5:32 
AnswerRe: get URL from previous web page Pin
Eddy Vluggen9-Mar-09 5:40
professionalEddy Vluggen9-Mar-09 5:40 
AnswerRe: get URL from previous web page Pin
edwin_nice9-Mar-09 6:04
edwin_nice9-Mar-09 6:04 
Questionhi Pin
mouhamad rayed8-Mar-09 23:21
mouhamad rayed8-Mar-09 23:21 
AnswerRe: hi Pin
dan!sh 8-Mar-09 23:57
professional dan!sh 8-Mar-09 23:57 
AnswerRe: hi Pin
Eddy Vluggen9-Mar-09 0:40
professionalEddy Vluggen9-Mar-09 0:40 
AnswerRe: hi Pin
Jon_Boy9-Mar-09 6:34
Jon_Boy9-Mar-09 6:34 
AnswerRe: hi Pin
0x3c09-Mar-09 7:02
0x3c09-Mar-09 7:02 
Questionproblemme capture picture from webcam programme not install on visual studio 2008 Pin
mouhamad rayed8-Mar-09 23:18
mouhamad rayed8-Mar-09 23:18 

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.