|
I dunno who downvoted you, but I ran your code and it returned a correct answer. I got
E:\MYTEMP~1\RESOUR~1\sql.txt
However, it will fail if the path does not exist. Try the API on an existing path, and it will work.
I are Troll
|
|
|
|
|
thanks for the reply. Can you please give the code in vb.net syntax.
|
|
|
|
|
Imports System
Imports System.Runtime.InteropServices
Imports System.Text
Namespace Test
Class Program
<DllImport("kernel32.dll", CharSet := CharSet.Auto)> _
Public Shared Function GetShortPathName( _
<MarshalAs(UnmanagedType.LPTStr)> path As String, _
<MarshalAs(UnmanagedType.LPTStr)> shortPath As StringBuilder, _
shortPathLength As Integer _
) As Integer
End Function
Public Shared Sub Main()
Dim shortPath As New StringBuilder(255)
GetShortPathName( _
"E:\My Temp\ResourseProvider\sql.txt", _
shortPath, _
shortPath.Capacity)
Console.WriteLine(shortPath.ToString())
Console.ReadKey()
End Sub
End Class
End Namespace
There you are
I are Troll
|
|
|
|
|
hi experts,
my windows forms application, is unable to be executed in a PC where dotnet is not installed.
the reason i expect would be, because, iam using a dll in my application.
though i make a release version, there is no use.
please let me know if any details are required from my side.
any suggestions to get through my problem would be appreiciable.
thanks in advance,
chandu.
--------------------------------------------
Suggestion to the members:
Please prefix your main thread subject with [SOLVED] if it is solved.
thanks.
chandu.
|
|
|
|
|
Are you sure that all dll libraries that you reference are installed on the target machine? Also you need to be sure that the machine supports the version of .NET that you have compiled against.
It's time for a new signature.
|
|
|
|
|
Running a Windows .NET application requires the presence of Windows and .NET
If you use an installer, make .NET one of the prerequisites there.
|
|
|
|
|
|
I'm sorry, but I can't see what you are after here. Was there a code block in there that didn't get rendered?
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
THS is up .5% today, but I don't think that is enough of a progress bar to provide a stock tip to such a wide audience.
|
|
|
|
|
bisharbn wrote: Please see ths
What?
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
|
|
|
|
|
Dear All
I'm .Net developer. In my project, When I compile a DLL in Vista PC and run it from the same PC It didn't response. When I disable DEP it responded but took too much time. But the same DLL which is complied in Xp machine response very quickly in Vista PC.( Complied in Xp and run in Vista)
What might be the reason for this greater performance issue?
Thank you,
RSumanan
|
|
|
|
|
Please do not repost. You have already posted question here[^]
Post your question only once.
HTH
Jinal Desai - LIVE
Experience is mother of sage....
|
|
|
|
|
Experts,
I have created one windows application and deployed it in some 500 machines in my company. The problem is, the applicaiton is updated weekely atlest. I cannot reinstall the .exe once again in all the 500 machines. Any solution for this.........
|
|
|
|
|
Please do not repost the question in different forum.
You question here[^] is already get attention and answered.
If you have not gone through the guidelines for posting question then
please go through with it here[^].
HTH
Jinal Desai - LIVE
Experience is mother of sage....
|
|
|
|
|
Please don't do this.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Hello,
I would like to ask why do I cannot display my records in my datagriview,
the database I use is sql server 2005 with ".mdf" extension. Also
if I use the wizard to add datasource I can add,delete records but when I run change
the startup form to show the records via code connection the records I think is gone or something
in my code is really wrong
The code I use is here:
Imports System.Data.SqlClient
Public Class Form2
Dim con As New SqlConnection
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
con.ConnectionString = "Data Source=.\SQLEXPRESS;" + _
"AttachDbFilename=|DataDirectory|\Database1.mdf;" + _
"Integrated Security=True;User Instance=True"
con.Open()
con.Close()
Dim da As New SqlDataAdapter
Dim dt As New DataTable
Dim ds As New DataSet
ds.Tables.Add(dt)
con.Open()
da = New SqlDataAdapter("SELECT * FROM phoneBookTable", con)
da.Fill(dt)
con.Close()
DataGridView1.DataSource = dt.DefaultView
Catch ex As Exception
MsgBox(ex.ToString)
con.Close()
End Try
End Sub
End Class
Thanks,
Dan
|
|
|
|
|
Try using following code instead of yours.
void FillData()
{
using (SqlConnection c = new SqlConnection(DataConnectionString))
{
c.Open();
using (SqlDataAdapter a = new SqlDataAdapter("SELECT * FROM phoneBookTable", c))
{
DataTable t = new DataTable();
a.Fill(t);
}
}
}
HTH
Jinal Desai - LIVE
Experience is mother of sage....
|
|
|
|
|
Hello,
Thanks for the help, but sorry to say I'm a bit confused about the code you have sent
The code seems not working ing vb 2008 or maybe I am wrong
Thanks over all in trying to help me.
Thanks,
Dan
|
|
|
|
|
The code I have posted is in CSharp.
Just use the idea, you do not need to follow
the exact code. Just follow the steps in VB, in
your way.
So, that you will get if you are missing something.
HTH
Jinal Desai - LIVE
Experience is mother of sage....
|
|
|
|
|
Hello,
Thank, I try to study it
I have some additional question's if you dont mind.
I notice that when I edit the database record and add data on it,
it can show the data that I have add via editing but when
I add data into the database using the wizard or form the records
seems to be dissapear everytime I change the startup form.
(info: form1 - the form that I use to connect via wizard
form2 - form I use via coding connection )
I'm so confused, I can add data but when everytime I change startup form
the records I have added seems gone ,
also everytime I add new records it just overwrite and it doesn't add new row
Below here is my code again :
Imports System.Data.SqlClient
Public Class Form2
Dim con As New SqlConnection
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
con.ConnectionString = "Data Source=.\SQLEXPRESS;" + _
"AttachDbFilename=|DataDirectory|\Database1.mdf;" + _
"Integrated Security=True;User Instance=True"
con.Open()
con.Close()
Dim da As New SqlDataAdapter
Dim dt As New DataTable
Dim ds As New DataSet
ds.Tables.Add(dt)
con.Open()
da = New SqlDataAdapter("SELECT * FROM phoneBookTable", con)
da.Fill(dt)
con.Close()
Dim newRows As DataRow = dt.NewRow
With newRows
.Item(0) = "2"
End With
dt.Rows.Add(newRows)
con.Open()
Dim cb As New SqlCommandBuilder(da)
da.Update(dt)
con.Close()
Dim newRows2 As DataRow = dt.NewRow
With newRows2
.Item(0) = "3"
End With
dt.Rows.Add(newRows2)
con.Open()
cb = New SqlCommandBuilder(da)
da.Update(dt)
con.Close()
DataGridView1.DataSource = dt.DefaultView
Catch ex As Exception
MsgBox(ex.ToString)
con.Close()
End Try
End Sub
End Class
thanks again,
Dan
|
|
|
|
|
|
Hello,
Thanks for the nice link. This is really helpfull.
Thanks,
Dan
|
|
|
|
|
My Pleasure.
Jinal Desai - LIVE
Experience is mother of sage....
|
|
|
|
|
Hello,
A 5 would be good to all of you helping newbie programmers
Thanks,
Dan
|
|
|
|
|
Thank you very much for appreciating.
Jinal Desai - LIVE
Experience is mother of sage....
|
|
|
|