|
Ok. You already have the XLM is a StringBuilder, so call it's ToString method to get the String version of it. Then it's a simple matter of normal File I/O to write that string to a file. Try this example[^].
|
|
|
|
|
Hi I am working on a system where I need to read the existing contents of various spreadsheets into tables in a sql database. Eg: a spreadsheet named "Branches" needs the contents of its columns stored into a table named "branches" in the sql database. Can anyone give me a hand with this? Thanks
|
|
|
|
|
use the link below,it will be very useful.
"http://www.dotnetspider.com/qa/Question50.aspx"
<div class="ForumMod">modified on Thursday, March 20, 2008 5:31 AM</div>
|
|
|
|
|
Thanks
|
|
|
|
|
Hi All
I Want Know My Program Is Runing. If My Prog Is Runing Do'n Run Again
tanks All
|
|
|
|
|
If (UBound(Diagnostics.Process.GetProcessesByName(Diagnostics.Process.GetCurrentProcess.ProcessName)) > 0) = True Then<br />
<br />
MessageBox.Show("Application is already running")<br />
End If
"Legacy code" often differs from its suggested alternative by actually working and scaling.
—Bjarne Stroustrup
|
|
|
|
|
Google for "VB.NET Single Instance" for other ideas on how to do this that may better fit your needs.
|
|
|
|
|
Hiya,
Well if you are using VB.NET then it is quite simple to only have one instance of your application running by first going to your application properties and then under the application tab, check the checkbox that says: "Make single instance application".
LLoyd
Lloyd J. Atkinson
"Logic will get you from A to B, but imagination will take you everywhere" - ALbert Einstein
The most annoying thing about Microsoft is its obsession with change.
|
|
|
|
|
Hello,
I am running a VB6 macro from excel and I was wondering if there was a way to stop execution after I begin running the program.
Thanks,
Orlando
|
|
|
|
|
Try
Control + Break on the keyboard
"Crtl" + Break
hope this helps
Anoop
|
|
|
|
|
I have a large number of records in excel i want to load the records
in oracle table using vb.net.I dont know how to do it.If anybody can pls help me.I dont want to do it manually.
|
|
|
|
|
These are two seperate operations. The first is reading an Excel sheet. The second is writing data to an Oracle database.
See this[^] for a small discussion.
|
|
|
|
|
How do I set the width for a column in a datagrid made from a dataview?
|
|
|
|
|
Which grid control are you using? DataGridView (VS2005 and above) or the DataGrid (VS2002 and 2003)??
|
|
|
|
|
Why do I get the error can't find column 1.
dtStudList = generalQuery(int)
dt.Columns.Add(New DataColumn("Student Name", GetType(String)))
'dt.Columns.Add(New DataColumn("Parent Name", GetType(String)))
'dt.Columns.Add(New DataColumn("Phone", GetType(String)))
'dt.Columns.Add(New DataColumn("Cell", GetType(String)))
'dt.Columns.Add(New DataColumn("Instrument", GetType(String)))
For Each row As DataRow In dtStudList.Rows
dr = dt.NewRow()
dr(0) = row("stud_name")
dr(1) = row("stud_par_name")
dr(2) = row("stud_id")
dr(3) = row("stud_phone")
dr(4) = row("stud_cell")
' get student instruments
intStudList = Convert.ToInt32(row("stud_id"))
tableName = "tbl_lessons"
dtStudInst = generalQuery()
' create counter
Dim intCount As Integer = 1
For Each row2 As DataRow In dtStudInst.Rows
If intCount = 1 Then
strInst = Convert.ToString(row2("less_instrument"))
Else
strInst += ", " & Convert.ToString(row2("less_instrument"))
End If
Next
'dr(5) = strInst
dt.Rows.Add(dr)
intCount += 1
Next
Dim dgView As New DataView(dt)
dgrStudList.DataSource = dgView
|
|
|
|
|
AAGTHosting wrote: Why do I get the error can't find column 1.
On which line does this error show up??
You do know that you commented out a bunch of Column.Add() statements near the top of your code snippet, right? Those columns aren't getting created.
|
|
|
|
|
I know. I just need to know what I am doing wrong with the dataGrid. I commented those lnes out to see if any of the columns would be able to be found.
|
|
|
|
|
OK. Again, on what line does the error occur??
|
|
|
|
|
Hello
I have posted this few days ago, I want to random records form MS access database and according to Christian Graus i have tried this it's working so so but i am still not happy i am still trying it but i dont know what to do now
this was before Christian's rep.
First code
Try<br />
<br />
Me.conTest.ConnectionString = _<br />
"Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source= MyTest.mdb"<br />
Catch eConnection As System.Exception<br />
MessageBox.Show(eConnection.Message)<br />
End Try<br />
<br />
'if array size is smaller then increase as per entry<br />
ArraySize = Count<br />
Dim IntegerArray(ArraySize) As Integer<br />
'sort integers<br />
Call SortArray(ArraySize, IntegerArray)<br />
Try<br />
odaTest.Fill(dsTest)<br />
'lblNo.Text = Me.BindingContext(dsTest.MyTest).Position<br />
Catch eLoad As System.Exception<br />
MessageBox.Show(eLoad.Message)<br />
End Try<br />
Call dsContacts_PositionChanged()<br />
End If<br />
<br />
this is for array <br />
<br />
Private Sub SortArray(ByVal N As Integer, ByVal SortedArray() As Integer)<br />
'increase the array size according to number of entry <br />
For I As Integer = 0 To N<br />
SortedArray(I) = I<br />
Next I<br />
End Sub
============
and this is after rep.
it's workind ok but i am sure i am doing something wrong but what ?
this is the new code
Try<br />
<br />
Me.conTest.ConnectionString = _<br />
"Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source= MyTest.mdb"<br />
Catch eConnection As System.Exception<br />
MessageBox.Show(eConnection.Message)<br />
End Try<br />
Me.conTest.Open()<br />
Dim MyData As New OleDb.OleDbCommand("SELECT *FROM MyTest ORDER BY ID ", conTest)<br />
Dim DR As Data.OleDb.OleDbDataReader = MyData.ExecuteReader<br />
Do While DR.Read = True<br />
ArraySize += 1<br />
Loop<br />
DR.Close()<br />
<br />
'if array size is smaller then increase as per entry<br />
Dim IntegerArray(ArraySize) As Integer<br />
'sort integers<br />
Call SortArray(ArraySize, IntegerArray)<br />
ReDim Asked(ArraySize)<br />
Call dsContacts_PositionChanged()<br />
<br />
Private Sub NavNext()<br />
If AskedQ >= ArraySize Then<br />
MessageBox.Show("Finish want to play again..?", "Finish", MessageBoxButtons.OK)<br />
For I As Integer = 0 To ArraySize<br />
Asked(I) = False<br />
AskedQ = 0<br />
Next<br />
Exit Sub<br />
Else<br />
Try<br />
Do<br />
odaTest.Fill(dsTest)<br />
R = CInt(Rnd() * ArraySize)<br />
'[Go to the next entry]<br />
Me.BindingContext(dsTest, "MyTest").Position = R<br />
Loop Until Asked(R) = False<br />
AskedQ += 1<br />
Asked(R) = True<br />
Catch eLoad As System.Exception<br />
MessageBox.Show(eLoad.Message)<br />
End Try<br />
'[See custom procedures]<br />
Me.dsContacts_PositionChanged()<br />
End If<br />
End Sub
waiting for your kind rep.
thanks you
|
|
|
|
|
bapu2889 wrote: Dim MyData As New OleDb.OleDbCommand("SELECT *FROM MyTest ORDER BY ID ", conTest)
Dim DR As Data.OleDb.OleDbDataReader = MyData.ExecuteReader
Do While DR.Read = True
ArraySize += 1
Loop
This is messy. If you need a count of elements, do select count(*) from mytest to get it in one go. This seems to me to be assuming that the Id's have no gaps in them, can you guarentee that ?
I'm not following how the rest works, but I *think* you're doing what I'd suggest in this instance ( keep a list of all the question Ids, then remove from that list at random to make sure no question gets asked twice )
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hello sir
first of all thank you very much for your super fast rep.
i am trying to get it to it but still i am in dark
you mean
Count = Me.BindingContext(dsTest, "MyTest").Count
some thing like this ?
and i can guarentee you that there is no gape in ID's
sir i am doing this since last one week so i think i am thinking too much and i am not seeing the thing which is in front of me
but it's nice fun
one day i will get there
waiting for your kind rep.
thanks again
|
|
|
|
|
OK, if your IDs are from 0-200, for example, then you need to build a list from 0-200
Then you get a random number between 0 and 200, pull out the number at that location, and get the record with that Id and show it. The next time, the number is between 0 and 199, because there's one less item in the list. You do this, because it means you're pulling at random, but you can never end up with the same record twice.
The other way to do this is to do a random shuffle on your list, you would do that by doing a sort method that returns a random result. Then you can work on the list in sequence.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hello sir
good morning
this is want i have done last night but still it's getting same questions again and again
but i will try your next command today but i dont know that i am going in to right direction
Private Sub Display()<br />
' Open the database.<br />
Dim conn As OleDbConnection = GetDbConnection()<br />
<br />
' See how many records there are.<br />
Dim query As String = "SELECT COUNT(*) FROM MyTest"<br />
Dim cmd As New OleDbCommand(query, conn)<br />
Dim num_records As Integer = cmd.ExecuteScalar()<br />
If txtNum.Text > num_records Then<br />
MsgBox("Hello there is only " & num_records & " records in database" & vbCrLf & _<br />
"So please enter " & num_records & " or less then " & num_records, MsgBoxStyle.Exclamation)<br />
Exit Sub<br />
End If<br />
' Make an array to hold the selected indexes.<br />
Dim num_random As Integer = num_records<br />
Dim Asked(num_random) As Boolean<br />
Dim indexes(num_random - 1) As Integer<br />
Dim sorted_indexes As New SortedList(num_random - 1)<br />
' Generate the indexes.<br />
Dim rand As New Random<br />
Dim I As Integer<br />
For I = 0 To num_random - 1<br />
' Generate the i-th index.<br />
Dim new_value As Integer = rand.Next(0, num_records - I)<br />
<br />
' For each previously generated index <=<br />
' than this one, increment this one.<br />
For j As Integer = 0 To I - 1<br />
If sorted_indexes.GetByIndex(j) <= new_value Then<br />
new_value += 1<br />
End If<br />
Next j<br />
<br />
' Save tjhe new value.<br />
indexes(I) = new_value<br />
sorted_indexes.Add(new_value, new_value)<br />
Next I<br />
query = "SELECT * FROM MyTest " & "WHERE Index=?"<br />
cmd = New OleDbCommand(query, conn)<br />
Dim i2 As Integer<br />
' Fetch record i.<br />
Dim index As Integer = indexes(i2)<br />
cmd.Parameters.Clear()<br />
cmd.Parameters.Add(New OleDbParameter("Index", index))<br />
Dim reader As OleDbDataReader = cmd.ExecuteReader(CommandBehavior.SingleRow)<br />
reader.Read()<br />
lblA.Text = reader.Item(i2).ToString<br />
' Close the connection.<br />
conn.Close()<br />
conn.Dispose()<br />
End Sub
thank you sir for your time
have a nice day
|
|
|
|
|
We run RunAsp Professional with XP to run a prgram that maps a network drive. It will also hide the mapped drive so noone can go to my computer and get to the drive.
My question, runAsp Professional does not work with Vista. Does anyone have a fix for this.
2nd question. We don't need runAsp if we can hide the mapped drive. Does anyone know how to do that in like a bat file.
thank you
|
|
|
|
|
<blockquote class="FQ"><div class="FQA">Cory Kimble wrote:</div>My question, runAsp Professional does not work with Vista. Does anyone have a fix for this.</blockquote>
How about asking the people who wrote runASP Pro?
What do you mena by "hiding" a share?? All you have to do to make a share not appear in the browser is end the name of the share with a $. But, it's still possible for users to get at it if they know what the name is.
|
|
|
|