Click here to Skip to main content
15,917,588 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: School Calendar using VB.Net Pin
0x3c09-Mar-09 21:13
0x3c09-Mar-09 21:13 
GeneralRe: School Calendar using VB.Net Pin
wr302810-Mar-09 1:38
wr302810-Mar-09 1:38 
GeneralRe: School Calendar using VB.Net Pin
EliottA10-Mar-09 3:38
EliottA10-Mar-09 3:38 
GeneralRe: School Calendar using VB.Net Pin
wr302810-Mar-09 6:58
wr302810-Mar-09 6:58 
GeneralRe: School Calendar using VB.Net Pin
0x3c010-Mar-09 7:04
0x3c010-Mar-09 7:04 
GeneralRe: School Calendar using VB.Net Pin
wr302810-Mar-09 18:31
wr302810-Mar-09 18:31 
GeneralRe: School Calendar using VB.Net Pin
wr302810-Mar-09 18:54
wr302810-Mar-09 18:54 
QuestionHighlight the background color Pin
BalasubramanianK9-Mar-09 20:02
BalasubramanianK9-Mar-09 20:02 
AnswerRe: Highlight the background color Pin
0x3c09-Mar-09 21:10
0x3c09-Mar-09 21:10 
GeneralRe: Highlight the background color Pin
BalasubramanianK9-Mar-09 23:30
BalasubramanianK9-Mar-09 23:30 
Questionabout web.config Pin
rajmca.g9-Mar-09 19:42
rajmca.g9-Mar-09 19:42 
QuestionProblem with auto increment. Pin
nazimghori9-Mar-09 18:11
nazimghori9-Mar-09 18:11 
AnswerRe: Problem with auto increment. Pin
dan!sh 9-Mar-09 18:17
professional dan!sh 9-Mar-09 18:17 
AnswerRe: Problem with auto increment. Pin
rajmca.g9-Mar-09 19:57
rajmca.g9-Mar-09 19:57 
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 

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.