|
Hi,
Can you help me with this
I have a need to send some data from database to a word template.
Do any body have any idea about it.
Example: If i have a word file as certificate.doc (with images and text)
and at particular occurance of a word as the text has to change with the data in the database table.
Any help... plz
Jats
|
|
|
|
|
That's not C# code.
You've done this on other forums - posting this uncompilable garbage code that can't possibly convert to anything meaningful.
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
C++ to C# Converter: converts C++ to C#
Instant C++: converts C# to C++/CLI and VB to C++/CLI
Instant Python: converts C# to IronPython and VB to IronPython
|
|
|
|
|
Hi to all
I have a problem with database in vb.net using sqlexpress.
My problem is:
I have created a.mdf database file and tables in it, and written code for inserting data to this table through command object. But my real prob is when i supply the connection string which is created by the "data configuration wizard" to this cmd object then on runtime insert executes and also datais visible in datagridview but when i check the data in the table it is not there and all fields are NULL. given connection string.
("Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\LIB.mdf;Integrated Security=True;User Instance=True")
But on the otherhand if i give connection string as ::
"Data Source=.\SQLEXPRESS;AttachDbFilename=D:\Documents and Settings\Administrator\My Documents\Visual Studio 2005\Projects\LIB\LIB\LIB.mdf;Integrated Security=True;User Instance=True"
then data is successfully inserted in the database and i m also able to view it in my database table.
So if Any one can help me it will be highly appreciable.
Thanks.
|
|
|
|
|
change the path to Application.startuppath & "\databasename" and try
Vilsad P P
MCTS (Windows Applications) .Net 2.0
|
|
|
|
|
hi thks for your reply.
I ttied it but it did not worked.
Please can u give it with an example o how to declare it.
Thanks
|
|
|
|
|
try this
<br />
dim constring as string = "Data Source=.\SQLEXPRESS;AttachDbFilename=" & application.startuppath & "\LIB.mdf;Integrated Security=True;User Instance=True"<br />
connect with this string
Note : after exiting application you need to click on server explorer and right click lib.mdf database and click on close connection and copy lib.mdf and lib.log files from debug folder to back to lib folder. otherwise you will not get the changes and the file will be overwritten with the old one when you are running your application again
Vilsad P P
MCTS (Windows Applications) .Net 2.0
|
|
|
|
|
Hi
When i try the constring u suggested i am getting another error at the point of cn.open, the error is as :
DriveLetter:\Project Folder\bin\Debug\LIB.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
what is this error about i cant understand.
|
|
|
|
|
Either that path doesn't exist or Sql Server already has that database attached. Use the SQL Server Management Studio to see if it's listed under the Databases folder in the Object Explorer.
|
|
|
|
|
Hi thx for reply.
as u suggested i serched it in sql server mgmt studio under databases but it is not listed there.
|
|
|
|
|
just add msgbox(constring) in my previous code after constructing constring. and run the application. varify that the message you are getting is pointing to the exact location of your database
Vilsad P P
MCTS (Windows Applications) .Net 2.0
|
|
|
|
|
I tried this and also got the database path correct but still i m getting the same error msg about auto-named and UNC share.
|
|
|
|
|
what is exactly you are getting about autonamed and unc shares ?
the error you are getting about the database name already exist is because it is already attached to sqlserver. if you have connected your database in server explorer, try to detach it and run this program error, i am not getting this error when i tried here. if this problem still exist after you detach db try after installing visual studio sp1
Vilsad P P
MCTS (Windows Applications) .Net 2.0
|
|
|
|
|
The |DataDirectory| portion of the AttachDbFilename path is only usable if your database file is in either the Data folder of the SQL Server Program Files folder or when using ClickOnce Deployment - I can't remember which.
You have to replace this with the full path to your database .MDF file for the connection string to work. If your database is in your applications .EXE folder, you can do something like this to get it work:
Dim dbPath As String = Path.Combine(Application.StartupPath, "mydatabase.mdf")
Dim connString As String = String.Format("Data Source=.\SQLEXPRESS;AttachDbFilename={0};Integrated Security=True;User Instance=True", dbPath)
|
|
|
|
|
hi
Thxs for u r reply.
Can u plz tell what is the key word "Path.combine"
because when i m writing the string u told about a message is displayed "Path" is not declared .
So let me know ,do i have to import some namespace or what should i do.
Regards
|
|
|
|
|
The Path class is defined in the System.Io namespace.
Stick this at the top of your code:
Imports System.Io
|
|
|
|
|
Hi by including IO class the error was removed but now i m getting this
error at the point of cn.open, the error is as :
DriveLetter:\Project Folder\bin\Debug\LIB.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
what is this error about i cant understand.
|
|
|
|
|
Hi,
I have a need to send some data from database to a word template.
Do any body have any idea about it.
Example: If i have a word file as certificate.doc (with images and text)
and at particular occurance of a word as <name> the text has to change with the data in the database table.
Any help... plz
Jats
|
|
|
|
|
You would probably have better luck getting this question answered if you asked in a forum that specialized in Word Interop, like this one[^] on MSDN.
|
|
|
|
|
Hi,
Thanks for the suggestion found a way.
Jats
|
|
|
|
|
Hi to all.
I am Having Some difficult to grabe from serial port (VB Communication) and to save data in an access database.
if someone could help me in this topic,by a simple example or a source code in VB6.
Thanks in advance
|
|
|
|
|
There's tons of examples out on the web. All you have to do is Google for "vb6 serial port", or click[^].
|
|
|
|
|
Hi All,
I want to capture incoming / outgoing raw-packet of NIC card.
And redirect/block packet for porn site etc.
I am VB6 coder and have no idea for C/C++.
Can somebody help me in this regards.
Sunil KC
from NEPAL
|
|
|
|
|
Sunil KC wrote: I want to capture incoming / outgoing raw-packet of NIC card.
And redirect/block packet for porn site etc.
I am VB6 coder and have no idea for C/C++.
Can somebody help me in this regards.
Well, time to start learning C, because to do this you'll need to write an NDIS driver and you can only do that in C or C++. Well, you can also do that in assembly, but I guess you won't want to do that.
|
|
|
|
|
can somebody help me by making a ndis driver with dll
|
|
|
|
|
There's no chance of this happening. You need a ton of driver development and kernel-level dugging skill to do this. From the sound of your question, you don't have to skills to pull this off yet.
|
|
|
|