Click here to Skip to main content
15,894,540 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: multiple Forms Pin
Dennis C. Dietrich26-Nov-04 14:55
Dennis C. Dietrich26-Nov-04 14:55 
GeneralRe: multiple Forms Pin
quhaip8826-Nov-04 17:02
quhaip8826-Nov-04 17:02 
GeneralVery large file problem Pin
Bloomers26-Nov-04 12:18
Bloomers26-Nov-04 12:18 
GeneralRe: Very large file problem Pin
Dennis C. Dietrich26-Nov-04 15:28
Dennis C. Dietrich26-Nov-04 15:28 
GeneralRe: Very large file problem Pin
Shree28-Nov-04 3:07
Shree28-Nov-04 3:07 
Generalspecifying proxy for webbrowser Pin
ddd0126-Nov-04 10:47
ddd0126-Nov-04 10:47 
GeneralVB question Pin
Paps226-Nov-04 8:48
Paps226-Nov-04 8:48 
GeneralRe: VB question Pin
sam683ir28-Nov-04 2:46
sam683ir28-Nov-04 2:46 
This 3 Functions Would Help ya To Do what ever you wnat.
please Pay attention To Remarks !
you know The Sign of The End of String (Data into Text File)
Must be "$" !
For Example :

Ram,10/12/72,M
Harish Chandra,19/06/77,M
Vanitha,20/01/73,F
$

OR

Ram,10/12/72,MHarish Chandra,19/06/77,MVanitha,20/01/73,F$
'********************************************************
If you Wana To See a Compiled Version of this Application
Check it Out :
http://www.honarejavan.com/upload/convertor.exe




'Read Data From TextFile
Dim total As String
Public Function WRD(mypath As String)
Dim MyLines As String
Open mypath For Input As #1
Do While Not EOF(1)
Line Input #1, MyLines$
WRD = WRD + MyLines
total = total + MyLines
Loop
Close #1
End Function
'Create a DB ConnectionString For Access DB
Function ACC(PTH As String)
ACC = "Provider=Microsoft.Jet.OLEDB.4.0.1;" & _
"Persist Security Info=False;" & _
"Data Source=" & PTH
End Function
'Create a DB ConnectionString For SQL DB
Function fSQL(DBname As String, DBADR As String, UID As String, PWD As String)
fSQL = "Provider=MSDASQL;Driver={SQL SERVER};Server=" & DBADR & ";UID=" & UID & ";PWD=" & PWD & ";Database=" & DBname
End Function

'processing and insertion
Function insert_2DB(STR As String, connstr As String)
Dim i, j As Integer 'Counter
'TWord Hold ALL characters
Dim TWord(10000), DB_name, DB_Date, DB_gender As String

'********************************
Dim Conn As New ADODB.Connection
Dim RS As New ADODB.Recordset
'SQL Query
Dim strSQL As String
strSQL = "SELECT * FROM test"
'Opening DataBase
Conn.Open (connstr)
With RS
.CursorType = 2
.LockType = 3
End With
RS.Open strSQL, Conn

'********************************

'Loop For insert characters into arrey
For i = 1 To Len(total)
TWord(i) = Mid(total, i, 1)
Next

j = 1 ' First Value of j must Be 1
Do Until (TWord(j) = "$" And Not STR = "")

'Catch The Name From Each Line
Do Until TWord(j) = ","
DB_name = DB_name + TWord(j)
j = j + 1
Loop

'Jump of ","
j = j + 1

'Catch The Date From Each Line
Do Until TWord(j) = ","
DB_Date = DB_Date + TWord(j)
j = j + 1
Loop

'Jump of ","
j = j + 1

DB_gender = TWord(j)
If DB_gender = "m" Or DB_gender = "M" Then
DB_gender = "Male"
Else
DB_gender = "Female"
End If


'Ready To Count New Line
j = j + 1

'Inserting Data into Database
RS.AddNew
RS("name").Value = DB_name
RS("DoB").Value = DB_Date
RS("Sex").Value = DB_gender
RS.Update

' Reset Values
DB_name = ""
DB_Date = ""
DB_gendewr = ""
total = ""

Loop
RS.Close
Conn.Close
End Function


Good Luck
S.A Mousavi From Iran.
GeneralRe: VB question Pin
Paps228-Nov-04 3:27
Paps228-Nov-04 3:27 
GeneralRe: Calling a c++ dll Pin
Dave Kreskowiak26-Nov-04 3:26
mveDave Kreskowiak26-Nov-04 3:26 
GeneralRe: Calling a c++ dll Pin
Member 142531829-Nov-04 4:14
Member 142531829-Nov-04 4:14 
GeneralNeed to extract open application window title bar Pin
Member 91913025-Nov-04 22:49
Member 91913025-Nov-04 22:49 
GeneralRe: Need to extract open application window title bar Pin
Dave Kreskowiak26-Nov-04 3:41
mveDave Kreskowiak26-Nov-04 3:41 
GeneralRe: Need to extract open application window title bar Pin
Member 91913028-Nov-04 16:38
Member 91913028-Nov-04 16:38 
GeneralRe: Need to extract open application window title bar Pin
Dave Kreskowiak28-Nov-04 17:20
mveDave Kreskowiak28-Nov-04 17:20 
GeneralRe: Need to extract open application window title bar Pin
Member 91913028-Nov-04 18:33
Member 91913028-Nov-04 18:33 
GeneralRe: Need to extract open application window title bar Pin
Dave Kreskowiak29-Nov-04 1:26
mveDave Kreskowiak29-Nov-04 1:26 
GeneralWant to read from an already opened Notepad file Pin
amitranjanmishra25-Nov-04 21:48
amitranjanmishra25-Nov-04 21:48 
GeneralRe: Want to read from an already opened Notepad file Pin
Dave Kreskowiak26-Nov-04 3:39
mveDave Kreskowiak26-Nov-04 3:39 
GeneralCalling a c++ dll Pin
Cedric Moonen25-Nov-04 21:47
Cedric Moonen25-Nov-04 21:47 
GeneralColor Palette Pin
Sai Ashok25-Nov-04 16:03
Sai Ashok25-Nov-04 16:03 
GeneralRe: Color Palette Pin
Dave Kreskowiak26-Nov-04 3:34
mveDave Kreskowiak26-Nov-04 3:34 
Generalcode documentation Pin
Paebbels25-Nov-04 9:20
Paebbels25-Nov-04 9:20 
GeneralRe: code documentation Pin
Colin Angus Mackay25-Nov-04 22:45
Colin Angus Mackay25-Nov-04 22:45 
GeneralRe: code documentation Pin
Paebbels26-Nov-04 4:33
Paebbels26-Nov-04 4:33 

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.