|
I'll check it out... Thanks!
I figured it must be related to the open database process since it's the first db-related operation in my code and it fails. The question remains: How can I tell VB to create a workspace for me and specify the fisical location of the .mdw file... guess I'll have to dig deeper!
Thanks again!
|
|
|
|
|
mikanu wrote: I figured it must be related to the open database process since it's the first db-related operation in my code and it
try the methods provided by the MSDN, I cant dig any deeper as my dev computer is boxed up waiting to be moved...
DEBUGGING : Removing the needles from the haystack.
|
|
|
|
|
How to import XML file in SQL Server using OPENXML?
I have XML file of 12MB size, containing whole database data & structure, but I can't paste it as a string in the SQL query. How to parse it to OPENXML function, to create database structure and to insert rowsets?
thanks.
|
|
|
|
|
|
I'm programming a windows form, and part of it is getting data from a SQL database, organizing it, and then displaying it. Short version of my question: How do I "refresh" the datagrid, dataview, or datatable such that changes to the datatable will be reflected in the datagridview that the user sees?
Long question:
He're's a dumbed down version of my code, with really obvious function names;
form_onLoad()
{
CrazyDataSet myDataSet;
DataView myView;
FillDataSetFromSQL();
FillCustomTable(); //the one that's going to be displayed.
myView = new DataView(myDataSet.ViewTable);
myView.rowFilter = someFilter();
myDataGridView.DataSource = myView;
}
buttonAddRow_onClick
{
AddRowToDataTable(row)
////HERE!!!
}
What do I do ^ there to have the new row show up in the datagridview? I know the dgv has refresh(), but the dataView is still unchanged, even though the datatable is not. Any suggestions? I googled and found dataView.dataBind, but it was from an article that was 3 years old and for the old DataGrid class.
|
|
|
|
|
private void RefreshGrid()
{
if (this.dataGridAllocation != null && this.dataTable != null)
{
CurrencyManager currencyManager = (CurrencyManager) this.dataGrid.BindingContext[this.dataTable];
if (currencyManager != null)
{
currencyManager.Refresh();
}
}
}
You can also do
datatable.AcceptChanges()
dataGrid.Refresh()
|
|
|
|
|
Hi Friend,
I am using early binding for getting the data from the store procedure in C++ COM DLL. All the data bind properly expect boolean value. I am doing
{
ADO_FIXED_LENGTH_ENTRY(5,ADODB::adBoolean,_rsFlag,_rsFlagStatus,FALSE)
BOOL rsFlag;
ULONG rsFlagStatus;
}
can you please help me in getting proper boolean value from store procedure.
Thanks
|
|
|
|
|
I have been given a Product table whoes all column types are varchar(8000)
One of the column is Price and other is DecimalPosition. Price column includes price without any decimal place and the data in DecimlaPosition column determins where the decimal should be placed.
So for instance, if the Price column includes '1000' and DecimalPosision includes '2' >> then it means that the actual price for this product is '10.00' and NOT '1000'. Similarly, if the DecimalPosision includes '3' >> then it means that the actual price for this product is '1.000' and NOT '1000'
My question is that when I am getting the price for a product from this table, how can I get the price in the correct format, e..g like '10.00' and not '1000'
Should I use SQL statements to convert 1000 into 10.00 or should I use some sort of programming logic to convert 1000 into 10.00.
kind regards
|
|
|
|
|
You can do it at both places. But its better to do this is a VIEW in the database. This way you avoid bugs. Hope this helps.
CREATE TABLE dbo.ctm
(
Precision varchar(32) NULL,
Val varchar(20) NULL
)
Insert ctm Values('1234567', '1')
Insert ctm Values('1234', '2')
Insert ctm Values('123456', '3')
Insert ctm Values('123456789', '4')
select convert (float,Val)/ POWER(10,convert (float,Precision)) from ctm
Use POW instead of POWER if you are not using sybase.
|
|
|
|
|
I have an access table that has a column called "ItemLink" and is of the type "Hyperlink." When I query this table and select this field, I get the display text of the hyperlink and not the url. How do I get the URL from this field in a query?
|
|
|
|
|
Please show me the steps of how to ocnfigure the MySQL database in windows XP platform?
beginner programmer..
|
|
|
|
|
Hi,
Does anyone knows how to remove the additional row that appeared at the end of the datagrid? I knew I can do that by setting the datagrid to read-only. But that is not my intention. I need to edit the cell in the datagrid. That's why I cannot set it to read-only.
Thanks,
kk
|
|
|
|
|
string connString = @"Provider=Microsoft.JET.OLEDB.4.0;data source=C:\northwind.mdb";
string sqlString = "SELECT * FROM customers";
// Connection object
OleDbConnection connection = new OleDbConnection(connString);
// Create data adapter object
OleDbDataAdapter dataAdapter = new OleDbDataAdapter(sqlString, connection);
// Create a dataset object and fill with data using data adapter's Fill method
DataSet dataSet = new DataSet();
dataAdapter.Fill(dataSet, "customers");
// Attach dataset's DefaultView to the datagrid control
dataGrid1.DataSource = dataSet.Tables["customers"];
//no adding of new rows thru dataview...
CurrencyManager cm = (CurrencyManager)this.BindingContext[dataGrid1.DataSource, dataGrid1.DataMember];
((DataView)cm.List).AllowNew = false;
|
|
|
|
|
alam_pune wrote: string connString = @"Provider=Microsoft.JET.OLEDB.4.0;data source=C:\northwind.mdb";
string sqlString = "SELECT * FROM customers";
// Connection object
OleDbConnection connection = new OleDbConnection(connString);
// Create data adapter object
OleDbDataAdapter dataAdapter = new OleDbDataAdapter(sqlString, connection);
// Create a dataset object and fill with data using data adapter's Fill method
DataSet dataSet = new DataSet();
dataAdapter.Fill(dataSet, "customers");
// Attach dataset's DefaultView to the datagrid control
dataGrid1.DataSource = dataSet.Tables["customers"];
//no adding of new rows thru dataview...
CurrencyManager cm = (CurrencyManager)this.BindingContext[dataGrid1.DataSource, dataGrid1.DataMember];
((DataView)cm.List).AllowNew = false;
Hi,
Thanks for replying. I've not tried to run your code snippet. I've a question on your code snippet that I'm not too sure (shown below). Pardon me as I'm a novice.
// Attach dataset's DefaultView to the datagrid control
dataGrid1.DataSource = dataSet.Tables["customers"];
//no adding of new rows thru dataview...
CurrencyManager cm = (CurrencyManager)this.BindingContextdataGrid1.DataSource, dataGrid1.DataMember];
((DataView)cm.List).AllowNew = false;
What's a CurrencyManager? What's the purpose of obtaining the CurrencyManager? Can I do this(shown below) instead?
DataView dv = dataSet.Tables["customers"].defaultview;
dv.AllowNew = false;
dataGrid1.DataSource = dv;
Thanks
kk
|
|
|
|
|
Yes you can.
But this assumes that only a DataTable or DataView is binded to the DataGrid.
Actually any object implementing IBindingList interface can have the functionality of AddNew, producing a new row you are trying to hide. CurrencyManager is a more generic class deriving from
BindingManagerBase.
Search MSDN, you will get a bunch of information..
|
|
|
|
|
ok. thanks.
|
|
|
|
|
Are you using a .net datagrid? Here is the c# code to hide a column by the index:
myGrid.Columns[0].Visible = true;
Dirk Watkins
|
|
|
|
|
Dear friends,
How are you?
Have you ever found us? anyway, kindly let me take this chance to introduce you our company:
we are a company engaged in Chinese antique furniture and arts and we do wholesale business abroad.We offer furniture such as beds,benches,cabinets,chairs,coffers,stands,stools,tables,desks,Tibetan and Mongolia furnishings and so on.As well as furniture,we have arts,decoratives,architecture and other perfect things.
We have a large warehouse over 93276 square foot area. It has developed many customers in North America, and Canada and other countries. And our price is lower than the others with good quality.
Kindly do not hesitate to let us know how can we help you to support and stand on you. We'll be more than delightful to develop any inquiries you may have and any concern we may help you solve in the future.
Looking forward to hearing from you soon.
Karen
Mingdragon Gallery,BeiJing
Address:No.616 XinDian Village,TongZhou District,BeiJing,China
Voice:13521208079
E-mail:contact@mingdragon.com
Website:http://www.Mingdragon.com
|
|
|
|
|
karenyuesong wrote: How are you?
Doing grand thanks.
karenyuesong wrote: Have you ever found us?
No, but I wasn't looking and one cannot find that which isn't being looked for.
karenyuesong wrote: Kindly do not hesitate to let us know how can we help you to support and stand on you
You want to stand on me?
If you would like to advertise on this site, then may I respectfully suggest this link as a starting point: http://www.codeproject.com/info/mediakit[^]
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucious
|
|
|
|
|
karenyuesong wrote: We have a large warehouse over 93276 square foot area.
So your question is about building a database to keep track of this floorspace ?
Or are you the dumbest spammer in history ?
karenyuesong wrote: We'll be more than delightful
I beg to differ. Your behaviour is not delightful, it's annoying.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
While designing my database, I came across a situation where there are multiple candidate keys. So I have assigned one of them as the primary key. But I need to add UNIQUE constraint to the remaining candidate key.
I am using MSDE and Visual Studio.Net 2003 Professional Edition. Is there a way to specifiy such a constraint using the IDE?
|
|
|
|
|
hi guys !
need urgent help
i m making an vb.net application which installs the required tables and triggers on calling
but first i wanna check
through commands that is the specified database exists or not and if not it should also be created through commands.
i m able to create database but unable to check that if it is already exists not to run that creation commands.
can u guys help me.
abhinav
|
|
|
|
|
You've not said what database you are using so I'll assume SQL Server 2000.
You can initially log in to the master database and check the sysdatabases table. e.g.
SELECT name FROM sysdatabases WHERE name=@nameOfDatabase
Does this help?
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucious
|
|
|
|
|
thanx colin it is working sorry didnt mentioned the database .yes it is sql2000
and now it is working..
can u also tellme the way of enumerating databases through vb.net commands i got an example in c#
http://www.codeproject.com/cs/database/SubmitSQLInfoEnumerator.asp[^]
but it is in c# i want to convert it to vb.net or any other eg. like that in vb.net
can u help me
abhinav
|
|
|
|
|
Hello,
i'm working a VC++ class that calls stored procedures using ADO,
and i'd really like to know how to set a VARIANT to a datetime value,
without using COleDateTime class.
so instead of:
_ParameterPtr pParameter = m_pCommand->CreateParameter(
_bstr_t(sParamName.c_str()),
adDBTimeStamp,
adParamInput,
0,
_variant_t(COleDateTime(1998, 10, 1, 0, 0, 0))
);
m_pCommand->Parameters->Append( pParameter);
i'd like to go
VARIANT vMyDate;
...then some how set vMyDate to '1997-10-1 0 '
then...
_ParameterPtr pParameter = m_pCommand->CreateParameter(
_bstr_t(sParamName.c_str()),
adDBTimeStamp, adParamInput,
0,
vMyDate
);
m_pCommand->Parameters->Append( pParameter);
why do i want to do this?
I'm working on an existing program, a massive monster of program with about 60 people working on it.
the existing class has functions which add parameters of various datatypes, but theres no function for datatime.
the program uses its own custom class to handle dates and times, from which i can easily extract formatted strings
I tried to use and the COleDateTime class, but the compiler didn't recognise it:
'COleDateTime' : undeclared identifier
I'd assume that means the correct header hasn't been included.
This is a bit of a problem, my workplace is very political and anti-microsoft (even though we use vc++ and mssql!), i'm very junior here, if i add a microsoft header file there's a very good chance someone senior will take it out and back out my changes.
Is there any chance that the header has been included and i need to specify a namespace?
I tried to add what i thought was the correct header:
afxdisp.h
and i get the error:
c:\program files\microsoft visual studio\vc98\mfc\include\afxv_w32.h(14) : fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include
can anyone offer me any suggestions?
thanks
Mat
|
|
|
|